-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passed
Description
Preconditions
- Magento 2.2.4
- PHP 7.1
- This issue is introduced by the following PR: Magento 2.2.0 A solution for Product Repeat Issue after filter on category listing page. #11429
Steps to reproduce
- Have a category in Magento with several products in it, all have the position in the category set to the value 0
- The default sort order should be set to position
- In Magento 2.2.3 the newest product in the database (the one with the highest entity_id) was shown first. With Magento 2.2.4 this behaviour changed. The oldest product is shown first, the newest last.
Expected result
- Product sort order should be the same between Magento 2.2.3 and Magento 2.2.4. This change is not documented, so can be qualified as a bug, because it was not the intended behaviour.
- Newest product should be shown first, oldest last.
Actual result
- Product sort order changed. The oldest product is shown first, the newest last.
Cause
In PR #11429 the following code was added:
->addAttributeToSort('entity_id', $this->getCurrentDirection());
The Order by for the SQL query for retrieving the products has changed from:
ORDER BY `cat_index_position` ASC, `cat_index`.`position` ASC, `e`.`entity_id` DESC
To
ORDER BY `cat_index_position` asc, `cat_index`.`position` asc, `e`.`entity_id` asc, `e`.`entity_id` DESC, `cat_index_position` asc, `cat_index`.`position` asc, `e`.`entity_id` asc
So as can be seen a e
.entity_id
asc is inserted in the order by before the default e
.entity_id
DESC is in the order by clause changing this behaviour.
mackieee
Metadata
Metadata
Assignees
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passed