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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Jacobs committed Jan 15, 2021
2 parents 5214dda + f841f23 commit 7d71c86
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 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;
}
}
}
1 change: 1 addition & 0 deletions view/frontend/layout/tweakwise_ajax_category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<update handle="empty"/>
<update handle="formkey"/>
<container name="root">
<container name="content"/>
<container name="sidebar.main"/>
Expand Down
1 change: 1 addition & 0 deletions view/frontend/layout/tweakwise_ajax_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
-->
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<update handle="empty"/>
<update handle="formkey"/>
<container name="root">
<container name="content"/>
<container name="sidebar.main"/>
Expand Down
9 changes: 8 additions & 1 deletion view/frontend/web/js/navigation-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,16 @@ define([
.replaceWith(newToolbarFirst.outerHTML);
}
if (newToolbarLast) {
var scripts = '';
$(newToolbarLast).siblings('script[type="text/x-magento-init"]').map(
function (index, element) {
scripts += element.outerHTML;
}
);

toolbar
.last()
.replaceWith(newToolbarLast.outerHTML);
.replaceWith(newToolbarLast.outerHTML + scripts);
}

$('body').trigger('contentUpdated');
Expand Down

0 comments on commit 7d71c86

Please sign in to comment.