From c6d166be701d9afe0b341ca35727af8a20db80f8 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Tue, 19 Dec 2017 14:46:13 +0200
Subject: [PATCH] magento/magento2#12205: Stock inventory reindex bug.
(cherry picked from commit 20d7afbe75fed9b8f45e3231848aae40b1c06a3a)
---
.../Model/ResourceModel/Indexer/Stock/DefaultStock.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php
index 519466c505539..c5644060c689f 100644
--- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php
+++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php
@@ -292,6 +292,7 @@ protected function _prepareIndexTable($entityIds = null)
*/
protected function _updateIndex($entityIds)
{
+ $this->deleteOldRecords($entityIds);
$connection = $this->getConnection();
$select = $this->_getStockStatusSelect($entityIds, true);
$select = $this->getQueryProcessorComposite()->processQuery($select, $entityIds, true);
@@ -314,7 +315,6 @@ protected function _updateIndex($entityIds)
}
}
- $this->deleteOldRecords($entityIds);
$this->_updateIndexTable($data);
return $this;