Skip to content

Commit 77d9c4e

Browse files
MAGE-1453 FIX : wrong test for category (#1848)
Function \Algolia\AlgoliaSearch\Block\Algolia::getCurrentCategory always return a category (see \Algolia\AlgoliaSearch\Registry\CurrentCategory::get), so we have to check is the returned category has an ID.
1 parent 588b96c commit 77d9c4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Block/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function isSearchPage(): bool
2727

2828
if ($this->getConfigHelper()->replaceCategories() && $request->getControllerName() === 'category') {
2929
$category = $this->getCurrentCategory();
30-
if ($category && $category->getDisplayMode() !== 'PAGE') {
30+
if ($category->getId() && $category->getDisplayMode() !== 'PAGE') {
3131
return true;
3232
}
3333
}
@@ -125,7 +125,7 @@ public function getConfiguration()
125125
&& $request->getControllerName() === 'category') {
126126
$category = $this->getCurrentCategory();
127127

128-
if ($category && $category->getDisplayMode() !== 'PAGE') {
128+
if ($category->getId() && $category->getDisplayMode() !== 'PAGE') {
129129
$category->getUrlInstance()->setStore($this->getStoreId());
130130
if (self::IS_CATEGORY_NAVIGATION_ENABLED) {
131131
$childCategories = $this->getChildCategoryUrls($category);

0 commit comments

Comments
 (0)