Get Free Audit

Catalog Price Rule Optimization

Oct 9, 2013

1367 Alex Simonchik

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

Magento support

Magento Support

Take your online store to the next level with BelVG Magento support

Visit the page

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

Igor Dragun
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor


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.

Igor Dragun

Partner With Us

Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor


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

Igor Dragun
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Igor

4 Comments

  1. Manaf,

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

  2. – (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.”

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *