From 18049fd59e8071a751b3f33a4e6e433e2754f989 Mon Sep 17 00:00:00 2001 From: ah-net <103565001+ah-net@users.noreply.github.com> Date: Tue, 22 Aug 2023 15:42:21 +0200 Subject: [PATCH] Fix bug multiple filters (#84) Fix bug in query parameter strategy --- .../Layer/Url/Strategy/QueryParameterStrategy.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.php b/Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.php index 01c28d6c..4477ea02 100644 --- a/Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.php +++ b/Model/Catalog/Layer/Url/Strategy/QueryParameterStrategy.php @@ -135,6 +135,13 @@ public function getClearUrl(MagentoHttpRequest $request, array $activeFilterItem */ protected function getCurrentQueryUrl(MagentoHttpRequest $request, array $query) { + $selectedFilters = $request->getQuery(); + foreach ($selectedFilters as $filter => $value) { + if (!array_key_exists($filter, $query)) { + $query[$filter] = $value; + } + } + $params['_query'] = $query; $params['_escape'] = false; @@ -529,6 +536,8 @@ private function getCurrentUrl(MagentoHttpRequest $request) : string return $this->url->getUrl('*/*/*', $params); } + $url = ltrim($url, '/'); + return str_replace($this->url->getBaseUrl(), '', $url); } }