Search code examples
magentomagento-1.9

How to re-index single product programmatically?


How to so index of single product? I have tried below code but it's not working.

Mage::getSingleton('index/indexer')->processEntityAction( $product, Mage_Catalog_Model_Product::ENTITY, Mage_Index_Model_Event::TYPE_SAVE )

is there any other solution?


Solution

  • You can do product indexing by their attribute like this:

    $indexer = Mage::getSingleton('index/indexer')->processEntityAction($_product, 'catalog_url', Mage_Index_Model_Event::TYPE_SAVE);
    

    Hope, it works for you.