What triggers the partial re-index on attribute mass update?
-
29-09-2020 - |
質問
I'm having a hard time figuring out what fires off the flat table update (partial re-indexing) when a attribute mass update is done from the Manage Catalog page in the admin.
When you mass-update attributes from the admin, the following methods are called in order.
Mage_Adminhtml_Catalog_Product_Action_AttributeController::saveAction
Mage_Catalog_Model_Product_Action::updateAttributes
Mage_Catalog_Model_Resource_Product_Action::updateAttributes
You can go straight to 3
to use the mass-update functionality, but the update doesn't propagate to the flat table. So, one would think it's something before 3
that triggers the re-indexing, but it's not clear what.
At first glance, 2
has
// register mass action indexer event
Mage::getSingleton('index/indexer')->processEntityAction(
$this, Mage_Catalog_Model_Product::ENTITY, Mage_Index_Model_Event::TYPE_MASS_ACTION
);
which looks like the answer, but the flat table is updated even with this commented out. I've even tried reducing Mage_Catalog_Model_Product_Action::updateAttributes
down to
the following, but it still re-indexes.
public function updateAttributes($productIds, $attrData, $storeId)
{
$this->_getResource()->updateAttributes($productIds, $attrData, $storeId);
return $this;
}
Any idea what actually updates the flat table when attribute mass update is done in the admin?
解決
The event controller_action_postdispatch_adminhtml_catalog_product_action_attribute_save
triggers the observer to initiate reindexing of the products updated in the mass-update.