Reindex Via Code

Posted Over 11 years ago. Visible to the public.

An example of code qhich allows you to reindex:

$indexer = Mage::getSingleton('index/indexer');
$process = $indexer->getProcessByCode('catalog_product_price');
$process->reindexEverything();

The following are indexer codes which you can use instead of the catalog_product_price
index above:

catalog_product_attribute     Product Attributes
catalog_product_price         Product Prices
catalog_url                   Catalog URL Rewrites
catalog_product_flat          Product Flat Data
catalog_category_flat         Category Flat Data
catalog_category_product      Category Products
catalogsearch_fulltext        Catalog Search Index
cataloginventory_stock        Stock Status
tag_summary                   Tag Aggregation Data

Mike Whitby
Last edit
About 10 years ago
Keywords
index, indexer
Posted by Mike Whitby to Magento (2012-08-16 14:34)