Pricing and promotions

OmniPrice – lowest price history

OmniPrice installation, CRON-based price history, performance settings and displaying previous lowest prices on product pages and listings.

About OmniPrice

This module will help you make your shop compliant with the EU Omnibus Directive.

It requires you to display the lowest price within a 30 day period before the promotion starting date.

This module displays an additional label on the product page for discounted products with the lowest historical price.

Installation

  1. log in to your Prestashop Back Office
  2. go to Modules
  3. click "Upload a module"
  4. select and upload the file "gm_omniprice.zip"
  5. configure the module
  6. set up the CRON task to make the module gather the prices on a daily basis
Important: reinstalling the moduleThe Polish manual states that using the reset/clear option or reinstalling the module deletes the stored price history. When updating, upload the new gm_omniprice.zip and use the update option rather than resetting the module.

Configuration

In the module you have the following options:

  • Period - number of days before promotion start to analyze
  • Ignore countries - store and display prices only for the default country
  • Ignore non EU countries - skip non EU countries totally, customers from non EU countries will not see any message about previous price
  • Ignore combinations - store and display prices only for the default combination
  • Ignored groups - ignore selected groups, display price for default group instead, the default group will be the Customer group. We set it to ignore unidentified and guest groups by default
  • Batch size - how many products should be processed in a single CRON task run. Set your CRON task to run as often as needed to finish the job. For example if you have a 1000 products in your shop, you can set the batch size to 100 products and run the CRON task every hour. It will give you more than enough runs to make sure all your prices are stored.
  • Reindex on product save - turn this option on to reindex product on each save. Reindexing a product with lots of combinations or on a store with many countries or currencies may take some time and slow down your back office. In this case keep this option turned off and make sure that the CRON task is executed often enough. If this option is turned on, the CRON task is still required, because price changes in your shop may have many different sources.
  • Text color, background color, price color - adjust appearance of the message to match your theme
  • Show label even if not enough history - for discounted products, if previous price is unknown, shows the current discounted price as the lowest one
  • Index inactive products - store price history even if the product is not active
  • Show real discount from the previous price (only PrestaShop 1.7 and above) - displays an additional information with percentage difference between current price and previous lowest price. The information is shown in parentheses after the previous lowest price.
  • Skip products sold below cost price - according to regulations in some countries (Italy for example), if a product is sold below the cost price, it will be treated as a not discounted product and the message will not be shown

Testing the historical price label

You can test the way the module displays the lowest price information by adding a ?omnipricetest=XXX parameter to product's page URL.

Performance and database size

Gathering price history may end up in your database becoming larger. The module needs to freeze all prices for all your currencies, customer groups, countries, products and attributes. Those prices depend on many factors in the moment they are displayed in your store, so we can't rely on any computations, we rather store them in the database.

The module tries it best to store only necessary data, so the database does not grow too much in size, but here is what you can also do to keep it as small as possible:

  • turn off unused currencies
  • update currency exchange rates less often
  • turn off countries that you don't sell your products to
  • set groups for which you don't use group discounts to be ignored, do the same for unused grups, not having any customers

Collecting price history (CRON)

Set up the main CRON price gathering task as often as you need to make it process all the products within a day. You can check how many times the CRON taks needs to be executed by launching it manually in your browser until it says that all products are indexed.

The gathering task has an additional optional &reset parameter. Using it forces the module to start reindexing products from the start (for the current day). This parameter may be useful if in your store the prices are injected directly into the database by some import module or external software. Prices like these will also get noticed, but it may come with a delay. Reseting the index may help you to minimize that delay.

Please remember, that price changes may have different sources (planned promotions, currency exchange rate fluctuations), so the CRON task must be always set as often as possible to minimize delays.

Cleaning price history (CRON)

Set up the cleaning task not more often than once a day. The cleaning task may also be helpful in case you gathered too many prices and want to clean up the database after turning on some ignore options (countries, groups etc.).

If the amount of information about old prices returned by the cleaning script on your server causes issues, add the parameter &silent to the script call.

Historical prices not showing?

Don't worry, the module needs some time to gather price history.

For the prices to display, the following conditions must be met:

  1. Current price is a special, discounted price
  2. There is at least one price stored in the price history, different from the current price
  3. The theme did not have the displayProductPriceBlock hook with parameter type="after_price" removed (it should by in every theme by default, usually in this file: \templates\catalog\_partials\product-prices.tpl)

Also please note, that to not bloat the database, the module stores price for a given product only once during the day, only if the price is greater than 0, it has changed compared to the previous price by more than 0,01 and only if the product is active.

In 99% of the cases, to make the module work properly you just need to give it some time and make sure, that the changes in prices occured after the installation of the module.

On product card in back office, you are able to view price change history. It may be useful to analyze what historical price should be displayed.

Promotions started before installation

OmniPrice cannot reconstruct prices that applied before its installation because those prices were not collected by the module.

For promotions already running before installation, the original Polish guide suggests temporarily disabling promotions, installing OmniPrice and collecting the standard prices. On the following day, enable the promotions again and index prices once more. This lets the module record a pre-discount price.

Alternatively, the configuration option to display the only known promotional price as the lowest price can be used, as described above.

Displaying historical prices on product listings

By default, the module shows historical price only on product page, but it can be simply extended to listings.

You only need to add the hook {hook h='displayProductPriceBlock' product=$product type="after_price"} to the TPL file responsible for displaying a product on the list.

In the standard PrestaShop theme, the file is: \templates\catalog\_partials\miniatures\product.tpl, which can be extended in the following way:

Example of the historical price information on a product listing.
Example of the historical price information on a product listing.

The reason why it is not there by default is that it would probably cause some stretching of product blocks. So to make the message look good on listings, it may be required to adjust the theme a little.

It is also possible that the message from the module will appear on the listings by default in case your theme has this hook already added there.

Need help?

Can’t find your answer? Contact our team.

Contact us