Programmatically Apply Catalog Rules

This article is outdated starting from  MageRewards v1.12.0!

After an import or mass change to Magento, you need to apply rules in order to see the points associated with the products. This pre-calculated the values for products so they can display faster in your catalog. You need to apply rules after an import for MageRewards catalog points rules (redemption and distribution) as well as Magento catalog promotion rules to take effect.

You can do so from your code, by executing the following PHP calls while Magento is initialized:

$resource = Mage::getResourceSingleton('catalogrule/rule');
$resource->applyAllRulesForDateRange(); // Applies all rules for yesterday, today and tomorrow.
Mage::app()->removeCache('catalog_rules_dirty'); // clear cache
		

Still need help? Get Help Get Help