0 votes
984 views
in Magento by
How to clear Magento cache/reindex programmatically?

1 Answer

0 votes
by
<?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 837 views
0 votes
2 answers 2.6k views
asked Oct 27, 2016 in Modules by Octavia
0 votes
1 answer 1.4k views
+1 vote
1 answer 7.5k views
asked Jan 31, 2018 in Magento by Edward121 (260 points)
0 votes
1 answer 14.3k views
+1 vote
1 answer 5.6k views
...