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()