- Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions and environment
- Magento version: 2.4.5
- A store view with any language thats not english
Steps to reproduce
Execute the following graphql query:
query searchProducts { products(search: "") { aggregations { label } } }This query fetches all available aggregations (filters) and the labels for them.
Expected result
I would expect all labels to be translated into the language of the store (german in my case).
{ "data": { "products": { "aggregations": [ { "label": "Preis" }, { "label": "Kategorie" }, { "label": "Farbe" }, { "label": "..." }, ] } } }Actual result
{ "data": { "products": { "aggregations": [ { "label": "Price" }, { "label": "Category" }, { "label": "Farbe" }, { "label": "..." }, ] } } }Only the label for the attribute color (Farbe) is translated as set in the adminhtml. The label set for the price attribute is ignored and I can't even set any label for the category attribute.
Additional information
The problem arises because of hardcoded labels in the code:
magento2/app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Category.php
Lines 152 to 156 in 91549b9
| $result = $this->layerFormatter->buildLayer( | |
| self::$bucketMap[self::CATEGORY_BUCKET]['label'], | |
| \count($categoryIds), | |
| self::$bucketMap[self::CATEGORY_BUCKET]['request_name'] | |
| ); |
magento2/app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Category.php
Lines 37 to 42 in 91549b9
| private static $bucketMap = [ | |
| self::CATEGORY_BUCKET => [ | |
| 'request_name' => 'category_uid', | |
| 'label' => 'Category' | |
| ], | |
| ]; |
and
magento2/app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Price.php
Lines 60 to 64 in 91549b9
| $result = $this->layerFormatter->buildLayer( | |
| self::$bucketMap[self::PRICE_BUCKET]['label'], | |
| \count($bucket->getValues()), | |
| self::$bucketMap[self::PRICE_BUCKET]['request_name'] | |
| ); |
magento2/app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Price.php
Lines 33 to 38 in 91549b9
| private static $bucketMap = [ | |
| self::PRICE_BUCKET => [ | |
| 'request_name' => 'price', | |
| 'label' => 'Price' | |
| ], | |
| ]; |
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status