From 20d7afbe75fed9b8f45e3231848aae40b1c06a3a 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.
---
.../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 366cb1c3902a3..317d055d3e481 100644
--- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php
+++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php
@@ -288,6 +288,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);
@@ -310,7 +311,6 @@ protected function _updateIndex($entityIds)
}
}
- $this->deleteOldRecords($entityIds);
$this->_updateIndexTable($data);
return $this;