Load Optimization of AdminSpecificPriceRule Controller in Prestashop

Nov 3, 2015112
Load Optimization of AdminSpecificPriceRule Controller in Prestashop

Catalog Price Rules is a widely used Prestashop tool for mass creation of discounts. But if you have a lot of features and feature_values associated with them, one day this function can get unavailable for you. Let’s check why exactly you won’t be able to use it.

1Load Optimization

The reason is hidden in the AdminSpecificPriceRuleControllerCore::renderForm method, and more particularly here:

The thing is while loading the form, Prestashop tries to load all features and their values because Catalog Price Rules allows using Features as one of the conditions for a discount.

2Load Optimization

We solved this problem using asynchronous load of Feature Values.

To do so made a few corrections:

1.

2. The FeatureValue::getFeatureValueWithLang() class is a new method that gets values for a particular Feature.

class FeatureValue extends FeatureValueCore

3.  The SpecificPriceRule::getConditions() class

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

4. Override of a theme file

/administration/themes/default/template/controllers/specific_price_rule/helpers/form/form.tpl

5. New action in AdminSpecificPriceRuleController::ajaxProcessGetFeatureValues() controller that is used in /administration/themes/default/template/controllers/specific_price_rule/helpers/form/form.tpl

Download all changed files here.


Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Vlad

2 Comments

  1. Hello,

    Is it possible to fix the link, download is not working. Also i am having issues to understand exactly where you need to modify, could you please look maybe you havent specified clearly what file and where to add/modify.

    Thank you

Post a new comment

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