Skip to content

2.3.4 GraphQl Aggregation Attribute labels and attribute option labels are not or incorrectly translated. #27657

@Hexmage

Description

@Hexmage

Preconditions (*)

  1. Magento 2.3.4
  2. 2 Storeviews
  3. Demo data

Steps to reproduce (*)

  1. Pick an attribute and configure it so its available as an aggregation in graphql (I chose "size")
  2. Set the attribute label for both storeviews
    Screenshot from 2020-04-08 17-01-43
  3. Set the attribute option labels for both storeviews
    Screenshot from 2020-04-08 17-01-49
  4. Run the following GraphQl query for both storeviews:
query products {
    products (filter: {
      category_id: {eq: "2"}
    } 
    ) {
        aggregations {
          attribute_code
          label
          options{
            count
            label
            value
          }
        }
    }
}

Expected result (*)

For default storeview

...
             {
                   "attribute_code": "size",
                   "label": "default",
                   "options": [
                       {
                           "count": 1,
                           "label": "55 cm default",
                           "value": "5518"
                       },
                       {
                           "count": 1,
                           "label": "65 cm default",
                           "value": "5519"
                       },
                       {
                           "count": 1,
                           "label": "default",
                           "value": "5520"
                       },
                       {
                           "count": 2,
                           "label": "default",
                           "value": "5521"
                       },
                       {
                           "count": 2,
                           "label": "default",
                           "value": "5522"
                       },
                       {
                           "count": 2,
                           "label": "default",
                           "value": "5523"
                       },
                       {
                           "count": 97,
                           "label": "XS default",
                           "value": "5594"
                       },
                       {
                           "count": 98,
                           "label": "default",
                           "value": "5595"
                       },
                       {
                           "count": 98,
                           "label": "default",
                           "value": "5596"
                       },
                       {
                           "count": 98,
                           "label": "default",
                           "value": "5597"
                       },
                      {...}
                   ]
               },
...

Actual result (*)

For default storeview

...
               {
                    "attribute_code": "size",
                    "label": "Size",
                    "options": [
                        {
                            "count": 1,
                            "label": "55 cm notdefault",
                            "value": "5518"
                        },
                        {
                            "count": 1,
                            "label": "65 cm notdefault",
                            "value": "5519"
                        },
                        {
                            "count": 1,
                            "label": "notdefault",
                            "value": "5520"
                        },
                        {
                            "count": 2,
                            "label": "notdefault",
                            "value": "5521"
                        },
                        {
                            "count": 2,
                            "label": "notdefault",
                            "value": "5522"
                        },
                        {
                            "count": 2,
                            "label": "notdefault",
                            "value": "5523"
                        },
                        {
                            "count": 97,
                            "label": "XS notdefault",
                            "value": "5594"
                        },
                        {
                            "count": 98,
                            "label": "notdefault",
                            "value": "5595"
                        },
                        {
                            "count": 98,
                            "label": "notdefault",
                            "value": "5596"
                        },
                        {
                            "count": 98,
                            "label": "notdefault",
                            "value": "5597"
                        },
                       {...}
                    ]
                },
...

What is happening is that the attribute label is never translated. And the attribute option labels pick the last entry in the database for each label. In my case "notdefault" because I entered those last.
I checked the code and at no point is the $storeId checked in the queries that gather the results.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions