Clear Magento cache/reindex

0 votes
261 views
asked Jun 13, 2016 in Magento by James
How to clear Magento cache/reindex programmatically?

1 Answer

0 votes
answered Jun 15, 2016 by Jerald Henry
<?php
// clear cache
Mage::app()->removeCache('catalog_rules_dirty');
// reindex prices
Mage::getModel('index/process')->load(2)->reindexEverything();
/*
1 = Product Attributes
2 = Product Attributes
3 = Catalog URL Rewrites
4 = Product Flat Data
5 = Category Flat Data
6 = Category Products
7 = Catalog Search Index
8 = Tag Aggregation Data
9 = Stock Status
*/
?>

Related questions

0 votes
0 answers 163 views
0 votes
2 answers 187 views
asked Oct 27, 2016 in Modules by Octavia
0 votes
1 answer 323 views
+1 vote
1 answer 15 views
0 votes
1 answer 38 views
+2 votes
0 answers 107 views
...