Skip to content

Sorting of configurable products on category pages is affected by the child product data #37508

Open
@hewgim

Description

@hewgim

Preconditions and environment

Magento vanilla version 2.4.5 and 2.4.6 with sample data
Elastic Search 7

Steps to reproduce

Create a new sort attribute called Custom Sort Order with drop down values 1,2,3,4,5

Add the Custom Sort Order attribute to the 'Top' attribute set

Set the Custom Sort order to 3 for all Tops

For the Juno Jacket configurable product set the custom sort order to 5

For the Juno Jacket child products set the custom sort order to 2

Goto to Women->Tops->Jackets and sort by Custom Sort Order

Expected result

The Juno Jacket configurable product should display last in the Jackets category because it has the highest sort order

Actual result

The Juno Jacket does not display last.

However if you now set all the Juno Jacket children with a sort priority of 5, the Juno Jacket configurable product will display last.

That means that the sorting of a parent configurable product is dependent on the sort data of both the parent and its children which doesn't make sense and is rather confusing. This appears to be behaviour brought in by the use of Elastic Search rather than MySql

Additional information

It is interesting to note that when you reverse the direction of the sort the Juno Jacket does appear first as expected.

I ran this in a debugger and stopped in vendor/magento/module_elastic_search-7/SearchAdapter/Adapter.php which appears to be used to obtain the sorted list of products. When I look at the $rawResponse array I can see that the sort data for the Juno Jacket configurable product contains the Custom Sort Order data from the children. When the direction of sorting is reversed the sort data contains the Custom Sort Order data from the parent.

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

No one assigned

    Labels

    Area: ProductComponent: ConfigurableProductIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.6Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions