From c4e00856327eddc2cbcde6d7d28dbf4dcab09afc Mon Sep 17 00:00:00 2001 From: Steve Tentrop Date: Tue, 6 Jul 2021 10:29:35 +0200 Subject: [PATCH 1/2] add template to condition --- src/Services/UrlService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Services/UrlService.php b/src/Services/UrlService.php index 87179ae11..f7f280245 100644 --- a/src/Services/UrlService.php +++ b/src/Services/UrlService.php @@ -134,7 +134,8 @@ function () use ($lang, $defaultLanguage, $ignoreCanonical) { if (substr(TemplateService::$currentTemplate, 0, 12) === 'tpl.category' || substr(TemplateService::$currentTemplate, 0, 12) === 'tpl.checkout' || - substr(TemplateService::$currentTemplate, 0, 14) === 'tpl.my-account') { + substr(TemplateService::$currentTemplate, 0, 14) === 'tpl.my-account' || + substr(TemplateService::$currentTemplate, 0, 11) === 'tpl.search') { $currentCategory = $categoryService->getCurrentCategory(); From 6821addb54ffee184c4c25c0ff0ae12e4481173a Mon Sep 17 00:00:00 2001 From: Steve Tentrop Date: Tue, 6 Jul 2021 10:47:49 +0200 Subject: [PATCH 2/2] add case for not shop builder --- src/Services/UrlService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Services/UrlService.php b/src/Services/UrlService.php index f7f280245..d3bb9dd43 100644 --- a/src/Services/UrlService.php +++ b/src/Services/UrlService.php @@ -151,7 +151,11 @@ function () use ($lang, $defaultLanguage, $ignoreCanonical) { return $this ->getCategoryURL($currentCategory->id, $lang) ->toAbsoluteUrl($includeLanguage); + } elseif (substr(TemplateService::$currentTemplate, 0, 11) === 'tpl.search') { + return pluginApp(UrlQuery::class, ['path' => RouteConfig::SEARCH, 'lang' => $lang]) + ->toAbsoluteUrl($includeLanguage); } + return null; } elseif (TemplateService::$currentTemplate === 'tpl.home' || TemplateService::$currentTemplate === 'tpl.home.category') { return pluginApp(UrlQuery::class, ['path' => "", 'lang' => $lang])