Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use new installment criteria in products query #242

Merged
merged 8 commits into from Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- `ProductSummaryList`: `installmentCriteria` prop to use in `products` query.
- `ProductSummaryList`: Messages and translations to be able to edit `skusFilter` and `installmentCriteria` in site editor.

## [2.51.7] - 2020-03-02
### Changed
Expand Down
18 changes: 18 additions & 0 deletions docs/ProductSummaryList.md
Expand Up @@ -35,3 +35,21 @@ This block is used to specify what variation of `product-summary` to be used to
| `orderBy` | `Enum` | Ordination type of the items. Possible values: `OrderByTopSaleDESC`, `OrderByReleaseDateDESC`, `OrderByBestDiscountDESC`, `OrderByPriceDESC`, `OrderByPriceASC`, `OrderByNameASC`, `OrderByNameDESC` | `OrderByTopSaleDESC` |
| `hideUnavailableItems` | `Boolean` | Hides items that are unavailable. | `false` |
| `maxItems` | `Number` | Maximum items to be fetched. | `10` |
| `skusFilter` | `SkusFilterEnum` | Control SKUs returned for each product in the query. The less SKUs needed to be returned, the more performant your shelf query will be. | `"ALL_AVAILABLE"` |
| `installmentCriteria` | `InstallmentCriteriaEnum` | ControlControl what pricee to be shown when price has different installments options. | `"MAX_WITHOUT_INTEREST"` |
klzns marked this conversation as resolved.
Show resolved Hide resolved

For `SkusFilterEnum`:

| Name | Value | Description |
| ---- | ----- | ----------- |
| First Available | `FIRST_AVAILABLE` | Most performant, ideal if you do not have a SKU selector in your shelf. Will return only the first available SKU for that product in your shelf query. |
| All Available | `ALL_AVAILABLE` | A bit better performace, will only return SKUs that are available, ideal if you have a SKU selector but still want a better performance. |
| All | `ALL` | Returns all SKUs related to that product, least performant option. |

For `InstallmentCriteriaEnum`:

| Name | Value | Description |
| ---- | ----- | ----------- |
| Maximum without interest | `MAX_WITHOUT_INTEREST` | Will display price with maximum value before interest. |
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
| Maximum with interest | `MAX_WITH_INTEREST` | Will display price with maximum value after interest applied. |
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
| Minimum | `MIN` | Will display the lowest price before interest. |
12 changes: 11 additions & 1 deletion messages/context.json
Expand Up @@ -54,5 +54,15 @@
"admin/editor.productSummaryList.orderType.nameDesc": "Name, descending",
"admin/editor.productSummaryList.orderType.releaseDate": "Release Date",
"admin/editor.productSummaryList.orderType.discount": "Discount",
"admin/editor.productSummaryList.orderType.relevance": "Relevance"
"admin/editor.productSummaryList.orderType.relevance": "Relevance",
"admin/editor.productSummaryList.skusFilter.title": "Title of skus filter property",
"admin/editor.productSummaryList.skusFilter.description": "Description of skus filter property",
"admin/editor.productSummaryList.skusFilter.none": "Value none of skus filter enum",
"admin/editor.productSummaryList.skusFilter.first-available": "Value first available of skus filter enum",
"admin/editor.productSummaryList.skusFilter.all-available": "Value all available of skus filter enum",
"admin/editor.productSummaryList.installmentCriteria.title": "Title of installment criteria property",
"admin/editor.productSummaryList.installmentCriteria.description": "Description of installment criteria property",
"admin/editor.productSummaryList.installmentCriteria.max-without-interest": "Maximum without interest enum name",
"admin/editor.productSummaryList.installmentCriteria.max-with-interest": "Maximum with interest enum name",
"admin/editor.productSummaryList.installmentCriteria.min": "Minimum enum name"
}
12 changes: 11 additions & 1 deletion messages/en.json
Expand Up @@ -54,5 +54,15 @@
"admin/editor.productSummaryList.orderType.nameDesc": "Name, descending",
"admin/editor.productSummaryList.orderType.releaseDate": "Release Date",
"admin/editor.productSummaryList.orderType.discount": "Discount",
"admin/editor.productSummaryList.orderType.relevance": "Relevance"
"admin/editor.productSummaryList.orderType.relevance": "Relevance",
"admin/editor.productSummaryList.skusFilter.title": "SKUs Filter",
"admin/editor.productSummaryList.skusFilter.description": "Setting the first available filter might make your query much faster!",
"admin/editor.productSummaryList.skusFilter.none": "None",
"admin/editor.productSummaryList.skusFilter.first-available": "First available",
"admin/editor.productSummaryList.skusFilter.all-available": "All available",
"admin/editor.productSummaryList.installmentCriteria.title": "Prices with Installment",
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
"admin/editor.productSummaryList.installmentCriteria.description": "Choose what type of prices to be showed in the products displayed (e.g.: maximum without interest or with interest, etc).",
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
"admin/editor.productSummaryList.installmentCriteria.max-without-interest": "Maximum without interest",
"admin/editor.productSummaryList.installmentCriteria.max-with-interest": "Maximum with interest",
"admin/editor.productSummaryList.installmentCriteria.min": "Minimum"
}
12 changes: 11 additions & 1 deletion messages/es.json
Expand Up @@ -54,5 +54,15 @@
"admin/editor.productSummaryList.orderType.nameDesc": "Nombre, descendiendo",
"admin/editor.productSummaryList.orderType.releaseDate": "Fecha de lanzamiento",
"admin/editor.productSummaryList.orderType.discount": "Descuento",
"admin/editor.productSummaryList.orderType.relevance": "Relevancia"
"admin/editor.productSummaryList.orderType.relevance": "Relevancia",
"admin/editor.productSummaryList.skusFilter.title": "Filtro de SKUs",
"admin/editor.productSummaryList.skusFilter.description": "¡Establecer el primer iten disponible agiliza su consulta!",
"admin/editor.productSummaryList.skusFilter.none": "Ninguno",
"admin/editor.productSummaryList.skusFilter.first-available": "Primero disponible",
"admin/editor.productSummaryList.skusFilter.all-available": "Todos disponibles",
"admin/editor.productSummaryList.installmentCriteria.title": "Criterio de precio a plazos",
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
"admin/editor.productSummaryList.installmentCriteria.description": "Elija qué tipo de precio se mostrará en los productos (por ejemplo, máximo sin interés, o con interés, etc.)",
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
"admin/editor.productSummaryList.installmentCriteria.max-without-interest": "Máximo sin interés",
"admin/editor.productSummaryList.installmentCriteria.max-with-interest": "Máximo con interés",
"admin/editor.productSummaryList.installmentCriteria.min": "Mínimo"
}
12 changes: 11 additions & 1 deletion messages/pt.json
Expand Up @@ -54,5 +54,15 @@
"admin/editor.productSummaryList.orderType.nameDesc": "Nome, decrescente",
"admin/editor.productSummaryList.orderType.releaseDate": "Data de lançamento",
"admin/editor.productSummaryList.orderType.discount": "Desconto",
"admin/editor.productSummaryList.orderType.relevance": "Relevância"
"admin/editor.productSummaryList.orderType.relevance": "Relevância",
"admin/editor.productSummaryList.skusFilter.title": "Filtro de SKUs",
"admin/editor.productSummaryList.skusFilter.description": "Configurando o valor de primeiro disponível pode fazer sua query ser mais rápida!",
"admin/editor.productSummaryList.skusFilter.none": "Nenhum",
"admin/editor.productSummaryList.skusFilter.first-available": "Primeiro Disponível",
"admin/editor.productSummaryList.skusFilter.all-available": "Todos Disponíveis",
"admin/editor.productSummaryList.installmentCriteria.title": "Preços com Parcelas",
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
"admin/editor.productSummaryList.installmentCriteria.description": "Escolha qual tipo de preço a ser mostrado nos produtos (ex.: máximo sem juros, ou com juros, etc).",
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
"admin/editor.productSummaryList.installmentCriteria.max-without-interest": "Máximo sem juros",
jgfidelis marked this conversation as resolved.
Show resolved Hide resolved
"admin/editor.productSummaryList.installmentCriteria.max-with-interest": "Máximo com juros",
"admin/editor.productSummaryList.installmentCriteria.min": "Mínimo"
}
27 changes: 26 additions & 1 deletion react/ProductSummaryList.js
Expand Up @@ -60,9 +60,9 @@ const ProductSummaryList = ({
specificationFilters = [],
maxItems = 10,
skusFilter,
installmentCriteria,
}) => {
const { data, loading, error } = useQuery(productsQuery, {
name: 'productList',
variables: {
category,
...(collection != null
Expand All @@ -76,6 +76,7 @@ const ProductSummaryList = ({
to: maxItems - 1,
hideUnavailableItems,
skusFilter,
installmentCriteria,
},
})

Expand Down Expand Up @@ -182,6 +183,30 @@ EnhancedProductList.getSchema = () => ({
isLayout: false,
default: 10,
},
skusFilter: {
title: 'admin/editor.productSummaryList.skusFilter.title',
description: 'admin/editor.productSummaryList.skusFilter.description',
type: 'string',
default: 'ALL_AVAILABLE',
enum: ['ALL_AVAILABLE', 'ALL', 'FIRST_AVAILABLE'],
enumNames: [
'admin/editor.productSummaryList.skusFilter.all-available',
'admin/editor.productSummaryList.skusFilter.none',
'admin/editor.productSummaryList.skusFilter.first-available'
]
},
installmentCriteria: {
title: 'admin/editor.productSummaryList.installmentCriteria.title',
description: 'admin/editor.productSummaryList.installmentCriteria.description',
type: 'string',
default: 'MAX_WITHOUT_INTEREST',
enum: ['MAX_WITHOUT_INTEREST', 'MAX_WITH_INTEREST', 'MIN'],
enumNames: [
'admin/editor.productSummaryList.installmentCriteria.max-without-interest',
'admin/editor.productSummaryList.installmentCriteria.max-with-interest',
'admin/editor.productSummaryList.installmentCriteria.min'
]
},
},
})

Expand Down