Skip to content

Commit 9d5a999

Browse files
committed
MAGETWO-80828: A solution for Product Repeat Issue after filter on category listing page. #11206
- Merge Pull Request #11206 from mayankzalavadia/magento2:issue11139-patch - Merged commits: 1. 5f7fcf6 2. 1e105b3
2 parents ea35a09 + 1e105b3 commit 9d5a999

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,11 @@ 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($this->getCurrentOrder(), $this->getCurrentDirection())->addAttributeToSort('entity_id', $this->getCurrentDirection());
197+
} else {
198+
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
199+
}
196200
}
197201
return $this;
198202
}

app/code/Magento/Wishlist/Model/Config.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ class Config
2222
/**
2323
* @var \Magento\Catalog\Model\Config
2424
*/
25-
private $_catalogConfig;
25+
private $catalogConfig;
2626

2727
/**
2828
* @var \Magento\Catalog\Model\Attribute\Config
2929
*/
30-
private $_attributeConfig;
30+
private $attributeConfig;
3131

3232
/**
3333
* Number of emails allowed for sharing wishlist
3434
*
3535
* @var int
3636
*/
37-
private $_sharingEmailLimit;
37+
private $sharingEmailLimit;
3838

3939
/**
4040
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
@@ -54,10 +54,10 @@ public function __construct(
5454
self::XML_PATH_SHARING_TEXT_LIMIT,
5555
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
5656
);
57-
$this->_sharingEmailLimit = $emailLimitInConfig ?: self::SHARING_EMAIL_LIMIT;
57+
$this->sharingEmailLimit = $emailLimitInConfig ?: self::SHARING_EMAIL_LIMIT;
5858
$this->_sharignTextLimit = $textLimitInConfig ?: self::SHARING_TEXT_LIMIT;
59-
$this->_catalogConfig = $catalogConfig;
60-
$this->_attributeConfig = $attributeConfig;
59+
$this->catalogConfig = $catalogConfig;
60+
$this->attributeConfig = $attributeConfig;
6161
}
6262

6363
/**
@@ -67,8 +67,8 @@ public function __construct(
6767
*/
6868
public function getProductAttributes()
6969
{
70-
$catalogAttributes = $this->_catalogConfig->getProductAttributes();
71-
$wishlistAttributes = $this->_attributeConfig->getAttributeNames('wishlist_item');
70+
$catalogAttributes = $this->catalogConfig->getProductAttributes();
71+
$wishlistAttributes = $this->attributeConfig->getAttributeNames('wishlist_item');
7272
return array_merge($catalogAttributes, $wishlistAttributes);
7373
}
7474

@@ -79,7 +79,7 @@ public function getProductAttributes()
7979
*/
8080
public function getSharingEmailLimit()
8181
{
82-
return $this->_sharingEmailLimit;
82+
return $this->sharingEmailLimit;
8383
}
8484

8585
/**

0 commit comments

Comments
 (0)