Kailash Yadav

Just another script samurai !!

Refresh Magento Cache Programmatically

When writing processes to automate some of Magento’s normally laborious tasks, perhaps for a product-import script, a mass attribute update script, category import, or inventory adjustment, keep in mind that you may have to refresh some kind of cache — especially when working with attributes. If you are encountering quirks or inconsistencies with your data, try these:

  • Rebuild Catalog Index Mage::getSingleton('catalog/index')->rebuild();
  • Rebuild Flat Catalog Product Mage::getResourceModel('catalog/product_flat_indexer')->rebuild();
  • Inventory Stock Mage::getSingleton('cataloginventory/stock_status')->rebuild()
posted by Kailash Yadav in e-commerce,Magento,PHP and have No Comments