diff --git a/src/module-elasticsuite-catalog/Plugin/Indexer/Category/Save/ReindexCategoryAfterSave.php b/src/module-elasticsuite-catalog/Plugin/Indexer/Category/Save/ReindexCategoryAfterSave.php index eb369d1ca..d47571f0c 100644 --- a/src/module-elasticsuite-catalog/Plugin/Indexer/Category/Save/ReindexCategoryAfterSave.php +++ b/src/module-elasticsuite-catalog/Plugin/Indexer/Category/Save/ReindexCategoryAfterSave.php @@ -51,9 +51,10 @@ public function aroundReindex( ) { $proceed(); - $categoryIndexer = $this->indexerRegistry->get(\Smile\ElasticSuiteCatalog\Model\Category\Indexer\Fulltext::INDEXER_ID); - - $categoryIndexer->reindexRow($subject->getId()); + if ($subject->getLevel() > 1) { + $categoryIndexer = $this->indexerRegistry->get(\Smile\ElasticSuiteCatalog\Model\Category\Indexer\Fulltext::INDEXER_ID); + $categoryIndexer->reindexRow($subject->getId()); + } return; } diff --git a/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php b/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php index 33a85c854..5c314397b 100644 --- a/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php +++ b/src/module-elasticsuite-virtual-category/Plugin/Catalog/Category/SaveProductsPositions.php @@ -69,7 +69,7 @@ public function aroundSave( \Closure $proceed, \Magento\Framework\Model\AbstractModel $category ) { - if ($category->getSortedProducts()) { + if ($category->getId() && $category->getSortedProducts()) { $this->unserializeProductPositions($category); $categoryResource->addCommitCallback(