Description
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”.