1

Back in Magento 1.3x there was a programatic way to kick off the index processing for a list of products. But somewhere between 1.3.x and 1.6.x Magento's indexing code was refactored and I can't figure out how to get that same functionality.

It seems that in CE 1.6+ we have the option of kicking off an indexing process for all products, or we have the option to kick off the indexing process for a single product. But I have a list of products (ten to a couple hundred) that I want to reindex, but I don't want to run them individually if possible.

If it makes a difference, I am only interested in the pricing index process.

2

I think there is. I started looking to see what happens when you select multiple products in the grid and bulk change attributes. In this method Mage_Catalog_Model_Product_Action::updateAttributes() some reindex event is registered.

Mage::getSingleton('index/indexer')->processEntityAction(
    $this, Mage_Catalog_Model_Product::ENTITY, Mage_Index_Model_Event::TYPE_MASS_ACTION
);

After digging deeper I ended up in this method for reindexing prices: Mage_Catalog_Model_Resource_Product_Indexer_Price::catalogProductMassAction(). So if you want to trigger a price reindexing process just for a few products you can call this method in your code.

Tip: if you are trying to reindex more than 30% of your products it will trigger 'reindex all prices' process. (I'm really curious on who came up with this 30% and how).

3
  • Would you mind sharing which version of Magento you are working with? Seems like I looked at something similar, and I think the "indexer" code was refactored to be in the Mage_Index module rather than Mage_Catalog and Mage_CatalogIndex.
    – shaune
    Mar 21 '13 at 19:18
  • I checked for CE version 1.7.0.2
    – Marius
    Mar 21 '13 at 22:49
  • I've checked for 1.6.0.0 and 1.6.1.0 and it seams to work in the same way. For 1.5.x and 1.4.x is similar. Only the class name is different: Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price. In version 1.3.x and lower I didn't find any price reindexing. But I didn't look hard enough because I didn't think it's that important.
    – Marius
    Mar 22 '13 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.