Thursday 6 March 2014

Index management magento programmatically


get All Index process collection

$allIndex= Mage::getSingleton('index/indexer')->getProcessesCollection();

foreach ($allIndex as $index) {
if ($index->getStatus() == Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX) {
$index->reindexEverything();
//echo "<pre>"; print_r($index->getProcess_id()); echo "</pre>";
}
}