Get Free Audit

Load Optimization of AdminSpecificPriceRule Controller in Prestashop

Nov 3, 2015

421 Alex Simonchik

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

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


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.

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

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

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