diff --git a/src/Block/Product/ListProduct.php b/src/Block/Product/ListProduct.php new file mode 100644 index 0000000..221425b --- /dev/null +++ b/src/Block/Product/ListProduct.php @@ -0,0 +1,88 @@ +request->getModuleName() === 'emico_attributelanding') { + $landingPageId = (int)$this->request->getParam('id'); + if (!empty($landingPageId)) { + $landingPage = $this->landingPageRepository->getById($landingPageId); + $filters = $this->registry->registry('tw_filters' . $landingPageId); + $filterTemplate = $landingPage->getTweakwiseFilterTemplate(); + $sortTemplate = $landingPage->getTweakwiseSortTemplate(); + + foreach ($filters as $filter) { + $queryParams[$filter->getFacet()] = $filter->getValue(); + } + + if (!empty($filterTemplate)) { + $queryParams['tn_ft'] = $filterTemplate; + } + + if (!empty($sortTemplate)) { + $queryParams['tn_st'] = $sortTemplate; + } + } + } + + return parent::getUrl($route, $params, $queryParams); + } +} diff --git a/src/etc/di.xml b/src/etc/di.xml index 455f574..17b038b 100644 --- a/src/etc/di.xml +++ b/src/etc/di.xml @@ -1,6 +1,7 @@ +