Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #141 from EmicoEcommerce/issue/127901-hidden-param…
Browse files Browse the repository at this point in the history
…eters

Issue/127901 hidden parameters
  • Loading branch information
edwinljacobs authored Jan 15, 2021
2 parents bb3897c + eed10b6 commit abdcc7c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Model/Catalog/Layer/NavigationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function addVisibilityFilter(ProductNavigationRequest $request)
}

foreach ($visibilityValues as $visibilityValue) {
$request->addAttributeFilter(self::VISIBILITY_ATTRIBUTE, $visibilityValue);
$request->addHiddenParameter(self::VISIBILITY_ATTRIBUTE, $visibilityValue);
}
}
}
19 changes: 17 additions & 2 deletions Model/Client/Request/ProductNavigationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class ProductNavigationRequest extends Request
*/
protected $path = 'navigation';

/**
* @var array
*/
protected $hiddenParameters = [];

/**
* {@inheritdoc}
*/
Expand All @@ -42,12 +47,22 @@ public function getResponseType()
* @param string $value
* @return $this
*/
public function addAttributeFilter($attribute, $value)
public function addAttributeFilter(string $attribute, $value)
{
$this->addParameter('tn_fk_' . $attribute, $value);
return $this;
}

/**
* @param string $attribute
* @param $value
*/
public function addHiddenParameter(string $attribute, $value)
{
$this->hiddenParameters[] = sprintf('%s=%s', $attribute, $value);
$this->setParameter('tn_parameters', implode('&', $this->hiddenParameters));
}

/**
* @param string $sort
* @return $this
Expand Down Expand Up @@ -104,4 +119,4 @@ public function setSortTemplateId($templateId)
$this->setParameter('tn_st', $templateId);
return $this;
}
}
}

0 comments on commit abdcc7c

Please sign in to comment.