Skip to content

Commit d8fc203

Browse files
MAGETWO-81942: Magento 2.2.0 A solution for Product Repeat Issue after filter on category listing page. magento#11429
2 parents c65c016 + cfa1293 commit d8fc203

File tree

1 file changed

+8
-1
lines changed
  • app/code/Magento/Catalog/Block/Product/ProductList

1 file changed

+8
-1
lines changed

app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,14 @@ public function setCollection($collection)
192192
$this->_collection->setPageSize($limit);
193193
}
194194
if ($this->getCurrentOrder()) {
195-
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
195+
if ($this->getCurrentOrder() == 'position') {
196+
$this->_collection->addAttributeToSort(
197+
$this->getCurrentOrder(),
198+
$this->getCurrentDirection()
199+
)->addAttributeToSort('entity_id', $this->getCurrentDirection());
200+
} else {
201+
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
202+
}
196203
}
197204
return $this;
198205
}

0 commit comments

Comments
 (0)