From 2af7b1400448c99ab2e86095170a2d6866fe4406 Mon Sep 17 00:00:00 2001 From: Lewis Voncken Date: Wed, 31 Jan 2018 12:56:12 +0000 Subject: [PATCH 1/2] [BUGFIX] Added row_id to the flat action indexer so the value isn't set to 0 for new products when using index on save --- .../Catalog/Model/Indexer/Product/Flat/Action/Indexer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php index 9dd312e9da801..3a1611299288c 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php @@ -175,6 +175,7 @@ public function write($storeId, $productId, $valueFieldSuffix = '') if (!empty($updateData)) { $updateData += ['entity_id' => $productId]; + $updateData += ['row_id' => $productId]; $updateFields = []; foreach ($updateData as $key => $value) { $updateFields[$key] = $key; From 07e2ca3489b37785dad61f004db7a28c451e7281 Mon Sep 17 00:00:00 2001 From: Lewis Voncken Date: Sat, 5 May 2018 19:34:28 +0200 Subject: [PATCH 2/2] [BUGFIX] Moved the indexAll after the product save in the Indexer Product Flat RowTest --- .../Catalog/Model/Indexer/Product/Flat/Action/RowTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php index 2b7c416f6be16..15c90891878a0 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php @@ -61,12 +61,13 @@ public function testProductUpdate() $this->_processor->getIndexer()->isScheduled(), 'Indexer is in scheduled mode when turned to update on save mode' ); - $this->_processor->reindexAll(); $this->_product->load(1); $this->_product->setName('Updated Product'); $this->_product->save(); + $this->_processor->reindexAll(); + $category = $categoryFactory->create()->load(9); $layer = $listProduct->getLayer(); $layer->setCurrentCategory($category);