Catalog Price Rule Optimization

Catalog Price Rule Optimization

I think many of you have heard about such a remarkable Mаgentо feature as Catalog Price Rule.

During one of our recent projects we faced a serious issue: our client had 1 website, 17 store views, over 50000 products and 200 Catalog Price rules. And he complained that the rules were no longer applying.

1Catalog Price Rule Optimization

During the investigation we found out that each time you create a new rule or edit an existing one and complete the process by clicking “Save and apply” Mаgentо rewrites all existing rules. I.e he method applyRules() is called during the function of saveAction() of the controller Mage_Adminhtml_Promo_CatalogController.

2Catalog Price Rule Optimization

So I created a module which, instead of rewriting all rules, recalculates only that one which has been edited. So now only a single rule is transmitted to the function updateRuleProductData(), which helped to solve the performance problem.

Due to this module changes to the database are made only for a certain rules and there is no chain reaction (re-saving the rest of the rules).

 

Smarty Apply Catalog Rule

Download Smarty Apply Catalog Rule from GitHub



2 comments

  1. – (re-saving the rest of the rules)

    here what is the issue while re-saving the rest of the rules? and how this becomes a for the customer’s complaint : ” And he complained that the rules were no longer applying.”

  2. Manaf,

    By default Magento is saving all rules while the module is changing only that one which has been changed.

Post a new comment

top