Skip to content

Commit

Permalink
Merge pull request #1010 from plentymarkets/fix/stable/canonical
Browse files Browse the repository at this point in the history
add template to condition
  • Loading branch information
stentrop authored Jul 7, 2021
2 parents 456b7f8 + 25ca69f commit 5fb58b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Services/UrlService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -150,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])
Expand Down

0 comments on commit 5fb58b3

Please sign in to comment.