Skip to content

Commit

Permalink
Merge branch 'fix_category_filter' into 2.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurélien FOUCRET committed Sep 27, 2016
2 parents 3cb7574 + dbd056e commit 9cfb355
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,25 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\Item
*/
public function getUrl()
{
$query = [
$this->getFilter()->getRequestVar() => $this->getValue(),
$this->_htmlPagerBlock->getPageVarName() => null,
$catRequestVar = $this->getFilter()->getRequestVar();
$pageRequestVar = $this->_htmlPagerBlock->getPageVarName();

$queryParams = [
$catRequestVar => $this->getValue(),
$pageRequestVar => null,
];

foreach ($this->getFilter()->getLayer()->getState()->getFilters() as $currentFilterItem) {
$query[$currentFilterItem->getFilter()->getRequestVar()] = null;
$currentRequestVar = $currentFilterItem->getFilter()->getRequestVar();
if ($currentRequestVar != $catRequestVar) {
$queryParams[$currentRequestVar] = null;
}
}

$url = $this->_url->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true, '_query' => $query]);
$url = $this->_url->getUrl(
'*/*/*',
['_current' => true, '_use_rewrite' => true, '_query' => $queryParams]
);

if ($this->getUrlRewrite()) {
$url = $this->getUrlRewrite();
Expand Down

0 comments on commit 9cfb355

Please sign in to comment.