forked from Smile-SA/elasticsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Smile-SA#1937 preventing displaying all products from catalog o…
…n deleted virtual category
- Loading branch information
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,15 +139,19 @@ public function __toString(): string | |
public function getCategorySearchQuery($category, $excludedCategories = []): ?QueryInterface | ||
{ | ||
$query = null; | ||
$rootCategory = null; | ||
|
||
if (!is_object($category)) { | ||
$category = $this->categoryFactory->create()->setStoreId($this->getStoreId())->load($category); | ||
} | ||
|
||
if (!in_array($category->getId(), $excludedCategories)) { | ||
$excludedCategories[] = $category->getId(); | ||
|
||
if ((bool) $category->getIsVirtualCategory() && $category->getIsActive()) { | ||
if ($category->getVirtualCategoryRoot() !== null && !empty($category->getVirtualCategoryRoot())) { | ||
$rootCategoryId = $category->getVirtualCategoryRoot(); | ||
$rootCategory = $this->categoryFactory->create()->setStoreId($this->getStoreId())->load($rootCategoryId); | ||
} | ||
if ((bool) $category->getIsVirtualCategory() && $category->getIsActive() && !is_null($rootCategory->getId())) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
vahonc
Author
Owner
|
||
$query = $this->getVirtualCategoryQuery($category, $excludedCategories, $category->getData('virtual_category_root')); | ||
} elseif ($category->getId() && $category->getIsActive()) { | ||
$query = $this->getStandardCategoryQuery($category, $excludedCategories); | ||
|
I believe here
$rootCategory
can still benull
so->getId()
would fail?