Skip to content

Commit 089bebc

Browse files
committed
m2-github-issue-3993; Fix same level categories (position)re-index on category move.
1 parent 5911255 commit 089bebc

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
@@ -433,7 +433,9 @@ public function move($parentId, $afterCategoryId)
433433
if ($this->flatState->isFlatEnabled()) {
434434
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
435435
if (!$flatIndexer->isScheduled()) {
436-
$flatIndexer->reindexList([$this->getId(), $oldParentId, $parentId]);
436+
$sameLevelCategories = explode(',', $this->getParentCategory()->getChildren());
437+
$list = array_unique(array_merge($sameLevelCategories, [$this->getId(), $oldParentId, $parentId]));
438+
$flatIndexer->reindexList($list);
437439
}
438440
}
439441
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);

0 commit comments

Comments
 (0)