Skip to content

Commit 7680391

Browse files
authored
ENGCOM-5639: #3993; Fix same level categories (position)re-index on category move. #23820
2 parents 8816969 + 30d6c4e commit 7680391

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/code/Magento/Catalog/Model/Category.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ public function move($parentId, $afterCategoryId)
448448
if ($this->flatState->isFlatEnabled()) {
449449
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
450450
if (!$flatIndexer->isScheduled()) {
451-
$flatIndexer->reindexList([$this->getId(), $oldParentId, $parentId]);
451+
$sameLevelCategories = explode(',', $this->getParentCategory()->getChildren());
452+
$list = array_unique(array_merge($sameLevelCategories, [$this->getId(), $oldParentId, $parentId]));
453+
$flatIndexer->reindexList($list);
452454
}
453455
}
454456
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);

0 commit comments

Comments
 (0)