0 votes
1.2k 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 1.0k views
0 votes
2 answers 3.0k views
asked Oct 27, 2016 in Modules by Octavia
0 votes
1 answer 1.6k views
+1 vote
1 answer 7.9k views
asked Jan 31, 2018 in Magento by Edward121 (260 points)
0 votes
1 answer 14.6k views
+1 vote
1 answer 5.9k views
...