From 46dd3303d5bde595ed3dd724f573f269b42efd1f Mon Sep 17 00:00:00 2001 From: ah-net <103565001+ah-net@users.noreply.github.com> Date: Wed, 23 Apr 2025 13:29:22 +0200 Subject: [PATCH 1/2] fix: filter url --- Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php b/Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php index 0d639e47..f256cb9f 100644 --- a/Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php +++ b/Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php @@ -395,7 +395,8 @@ public function buildFilterUrl(MagentoHttpRequest $request, array $filters = []) } else { // Replace filter path in current URL with the new filter combination path if (strpos($currentUrl, $currentFilterPath) !== false) { - $url = str_replace($currentFilterPath, $newFilterPath, $currentUrl); + rtrim($currentFilterPath, '/'); + $url = str_replace($currentFilterPath.'/', $newFilterPath.'/', $currentUrl); } else { $url = $currentUrl . '/' . $newFilterPath; } From 68c7b6334c35aaa5822ac8bf9fb6982ebf557f91 Mon Sep 17 00:00:00 2001 From: ah-net <103565001+ah-net@users.noreply.github.com> Date: Wed, 23 Apr 2025 13:51:29 +0200 Subject: [PATCH 2/2] Style fix --- Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php b/Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php index f256cb9f..861e722c 100644 --- a/Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php +++ b/Model/Catalog/Layer/Url/Strategy/PathSlugStrategy.php @@ -396,7 +396,7 @@ public function buildFilterUrl(MagentoHttpRequest $request, array $filters = []) // Replace filter path in current URL with the new filter combination path if (strpos($currentUrl, $currentFilterPath) !== false) { rtrim($currentFilterPath, '/'); - $url = str_replace($currentFilterPath.'/', $newFilterPath.'/', $currentUrl); + $url = str_replace($currentFilterPath . '/', $newFilterPath . '/', $currentUrl); } else { $url = $currentUrl . '/' . $newFilterPath; }