From 8aae6e2b7850207488d19644d658f5b48e49c884 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 12 Jul 2023 14:07:20 +0200 Subject: [PATCH] Do not reindex catalog_product_flat for disabled stores (#3251) Co-authored-by: Fabrizio Balliano --- app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php | 2 +- .../core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php b/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php index 7393ffe487a..ec0abf090e2 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php +++ b/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php @@ -151,7 +151,7 @@ public function matchEvent(Mage_Index_Model_Event $event) } else { /** @var Mage_Core_Model_Store $store */ $store = $event->getDataObject(); - if ($store && $store->isObjectNew()) { + if ($store && ($store->isObjectNew() || $store->getOrigData('is_active') != $store->getIsActive() && $store->getIsActive())) { $result = true; } else { $result = false; diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php index 7f0bdfa2eaa..eecb7aaacbe 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php @@ -1400,6 +1400,9 @@ protected function _arrayNextKey(array $array, $key) public function reindexAll() { foreach (Mage::app()->getStores() as $storeId => $store) { + if (!$store->getIsActive()) { + continue; + } $this->prepareFlatTable($storeId); $this->beginTransaction(); try {