Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

docs: use attribute labels as values #690

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions versioned_docs/version-2.x/appendices/migration-guides/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@ import TabItem from "@theme/TabItem";

## `2.24.0` -> `2.25.0`

### Use facet labels as values

To opt-in to using facet labels as values, you must add the following following configuration to your `config/website`:

```js title="config/website.js"
module.exports = {
...
search: {
dynamicFacetSize: 10,
ignoredAttributeKeys: [],
attributeFacetMinimumDocumentCount: 1,
authorizedCategoriesFacet: [],
categoryFacetMinimumDocumentCount: 1,
// add-next-line
useAttributeLabels: true,
},
};
```

This also introduced the new `isUsingIdsForAttributes` method for datasources, if you have custom datasources,
you must implement this method.

If your datasource already uses labels as values the method should return `false`, for example:
- [Algolia](https://gitlab.blackswift.cloud/front-commerce/front-commerce/-/blob/08ab2dd5a9b128592df2b76f1975b061dc2639e0/modules/datasource-algolia/server/datasource/index.js#L193-195) uses labels as values
- [Elasticsearch](https://gitlab.blackswift.cloud/front-commerce/front-commerce/-/blob/08ab2dd5a9b128592df2b76f1975b061dc2639e0/modules/datasource-elasticsearch/server/datasource/index.js#L225-227) uses ids as values

### Multi shipment enhanced display

:::info
Expand Down
2 changes: 2 additions & 0 deletions versioned_docs/version-2.x/reference/configurations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ your website. The term website refers to what a
that means only category facets leading to at least one document are
displayed. By setting it to 0, category facets leading to no document are
also displayed but disabled in the UI.
- `useAttributeLabels`: if set to `true`, the attribute labels will be used
instead of the attribute codes in the filters. Default value: `false`.
- `theme-color`: a CSS value that will be used in your layout for a
`<meta name="theme-color" />`
- `phoneNumber`: support/contact number of the website
Expand Down