From 1d998f9c45856497332daddd930786ee42d458cb Mon Sep 17 00:00:00 2001 From: Mayank <mayankz@emiprotechnologies.com> Date: Fri, 13 Oct 2017 18:19:11 +0530 Subject: [PATCH] Magento 2.2.0 Product Repeat Isuue after filter on category listing page.Issue : #11139 --- .../Catalog/Block/Product/ProductList/Toolbar.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php index f461b525152..46080ab5c33 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php @@ -192,7 +192,14 @@ class Toolbar extends \Magento\Framework\View\Element\Template $this->_collection->setPageSize($limit); } if ($this->getCurrentOrder()) { - $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection()); + if (($this->getCurrentOrder()) == 'position') { + $this->_collection->addAttributeToSort( + $this->getCurrentOrder(), + $this->getCurrentDirection() + )->addAttributeToSort('entity_id', $this->getCurrentDirection()); + } else { + $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection()); + } } return $this; } -- GitLab