Skip to content

Commit ada41e1

Browse files
Merge pull request #1457 from magento-engcom/2.1-develop-prs
[EngCom] Public Pull Requests - 2.1 - MAGETWO-71643: [BUGFIX] Flat Category reindexList of AllChildren if the url_key of t… #10557
2 parents 5cfad89 + 7bf1877 commit ada41e1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,11 @@ public function reindex()
10921092
if ($this->flatState->isFlatEnabled()) {
10931093
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
10941094
if (!$flatIndexer->isScheduled()) {
1095-
$flatIndexer->reindexRow($this->getId());
1095+
$idsList = [$this->getId()];
10961096
if ($this->dataHasChangedFor('url_key')) {
1097-
$flatIndexer->reindexList(explode(',', $this->getAllChildren()));
1097+
$idsList = array_merge($idsList, explode(',', $this->getAllChildren()));
10981098
}
1099+
$flatIndexer->reindexList($idsList);
10991100
}
11001101
}
11011102
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);

app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec
437437
->will($this->returnValue(true));
438438

439439
$this->flatIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($flatScheduled));
440-
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexRow')->with('123');
440+
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexList')->with(['123']);
441441

442442
$this->productIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($productScheduled));
443443
$this->productIndexer->expects($this->exactly($expectedProductReindexCall))->method('reindexList')->with($pathIds);

0 commit comments

Comments
 (0)