diff --git a/app/code/core/Mage/Catalog/Model/Indexer/Url.php b/app/code/core/Mage/Catalog/Model/Indexer/Url.php index 3d1db33adfca..74e59b2530cf 100644 --- a/app/code/core/Mage/Catalog/Model/Indexer/Url.php +++ b/app/code/core/Mage/Catalog/Model/Indexer/Url.php @@ -48,7 +48,8 @@ class Mage_Catalog_Model_Indexer_Url extends Mage_Index_Model_Indexer_Abstract */ protected $_matchedEntities = array( Mage_Catalog_Model_Product::ENTITY => array( - Mage_Index_Model_Event::TYPE_SAVE + Mage_Index_Model_Event::TYPE_SAVE, + Mage_Index_Model_Event::TYPE_MASS_ACTION ), Mage_Catalog_Model_Category::ENTITY => array( Mage_Index_Model_Event::TYPE_SAVE @@ -181,13 +182,33 @@ protected function _registerEvent(Mage_Index_Model_Event $event) protected function _registerProductEvent(Mage_Index_Model_Event $event) { $product = $event->getDataObject(); - $dataChange = $product->dataHasChangedFor('url_key') - || $product->dataHasChangedFor('status') - || $product->getIsChangedCategories() - || $product->getIsChangedWebsites(); - if (!$product->getExcludeUrlRewrite() && $dataChange) { - $event->addNewData('rewrite_product_ids', array($product->getId())); + if (is_a($product, Mage_Catalog_Model_Product_Action::class)) { + $attributesData = $product->getData('attributes_data'); + $productsIds = $product->getData('product_ids'); + if ($dataChange = isset($attributesData['status']) && isset($productsIds) && count($productsIds) > 0) { + $products = Mage::getModel('catalog/product')->getCollection() + ->addFieldToFilter('entity_id', array('in'=> $productsIds)); + } else { + return; + } + } + + if (is_a($product, Mage_Catalog_Model_Product::class)) { + $dataChange = + ( + $product->dataHasChangedFor('url_key') + || $product->dataHasChangedFor('status') + || $product->getIsChangedCategories() + || $product->getIsChangedWebsites() + ) && !$product->getExcludeUrlRewrite(); + $products = [$product]; + } + + if ($dataChange) { + foreach ($products as $product) { + $event->addNewData('rewrite_product_ids', array($product->getId())); + } } }