I update prices in magento programmatically. How can I reindexing prices after this update. Now I used SSH command:
php indexer.php --reindex catalog_product_price
The following will reindex each index.
for ($i = 1; $i <= 9; $i++) {
$process = Mage::getModel('index/process')->load($i);
$process->reindexAll();
}
You can also use the Magento collection model to load each index rather than hard coding the id in the for loop.
/* @var $indexCollection Mage_Index_Model_Resource_Process_Collection */
$indexCollection = Mage::getModel('index/process')->getCollection();
foreach ($indexCollection as $index) {
/* @var $index Mage_Index_Model_Process */
$index->reindexAll();
}
But if you want to reindex just the price the id is 2
$process = Mage::getModel('index/process')->load(2);
$process->reindexAll();
You could also call the function getProcessByCode as follows:
$process = Mage::getModel('index/indexer')->getProcessByCode('catalog_product_price');
$process->reindexAll();