Jump to content

Recommended Posts

Hello all,

 

Here I would like to share with you the way I decided to add a discount at every product in Prestashop versions 1.4.7.3 and 1.5.2 . I have tested this solution at these versions only but it might be similar for other versions.I have searched a bit but was not able to locate an existing solution to fit my needs (maybe I missed them). I feel that I have to share this since I have learned many things from this forum !!

 

So for Version 1.5.2

 

Log in to your Back office (admin area) and go to menu Price Rules/ Catalog Price Rules and press "New". At the page that opens fill in the price rule info like:

Name = "Christmas Offer -20%",

Currency = "All currencies",

Country = "All countries",

Group = "All groups",

From quntity = "1" (you can set here the number of products that have to be added to the cart in order this offer to be valid)

Price (tax excl.) = "Leave base price" (the checkbox)

From and To (the date range you want this offer to be applicable)

Reduction type = "Percentage"

Reduction = "20.00"

 

and click save.

 

After that there will be a message over all product prices, at the products list (when you click to view all products of a category), that sais something like "Reduced Price!" and the prices displayed will be redused by 20%. The product page (when you click to see the product details) should have more details about the discount.

 

In order to show the original price of the products in the product list, back up files theme/yourTheme/css/global.css , theme/yourTheme/product-list.tpl. Also from your Back office go to "Advanced Parameters" and set Template Cache to Force compilation and Cache to No "the X mark" (so you can see the changes you make on the files).

 

Open file theme/yourTheme/css/global.css with a text editor and at the very bottom add a new class like:

.my-old-product-price-style{ color:red; text-decoration:line-through; }

 

Open file theme/yourTheme/product-list.tpl and go to line 53 and add this

<span class="my-old-product-price-style">{convertPrice price=($product.price/0.8)}</span>

just before the <span class="price" style="display: inline;"> . The 0.8 derives from 100 - 20(our discount 20%) = 80 -> 80% = 0.8 .

 

So now you will be able to see the original price of your products at the products list. Don't forget to set Template Cache to Never Recompile Template Files and Cache to Yes "the tick mark"

 

 

For Version 1.4.7.3

 

Unfortunatelly version 1.4.7.3 is not as advanced as 1.5.2 for this kind of discount, so if you can you should upgrade to 1.5.2. If you can not upgrade, follow these steps.

 

The proper way, I suppose, is to go at each product and add a "Spesific price" from the prices tab. But it is a lot of work if you have 200 products. Also if you wish to create a mysql query it will get very complicated and perhaps you will get it wrong. So I suggest the following solution.

 

First I have to emphasize that this solution will cover your discount needs only if you have one customer group (or you want to add the same discount to every customer group). The changes I suggest to some files will be visible to all Customers groups even if they do not have any discount.

 

Also the prices at the front office are displayed with tax included.

 

From the back office go to Customers/ Groups. Click the edit button of the group you want to apply the discount (eg. Default), and set the Discount to 20 % and click save.

 

What we have accomplished with this is when users of this customer group visit your site they will see the prices reduced but there will be no notification about this discount.

 

Display the "On sale!" message

From your phpMyAdmin create a back up of the ps_product (where ps_ is your prefix) table and then run the query

update ps_product set on_sale=1

 

Now in the products list and products details page you will see the message "On sale!" above the product's price.

 

Display the old price

 

For this again we have to edit some files of your theme. But first go to the back office -> Preferences-> Performance and set Force compile = "Yes" and Cache = "No".

 

Keep a back up of the files theme/yourTheme/css/global.css , theme/yourTheme/product-list.tpl andtheme/yourTheme/product.tpl.

 

Open the global.css and create a new class like this

.my-old-product-price-style{ color:red; text-decoration:line-through; }

 

Open the product-list.tpl file and at line 20 add this:

<span class="my-old-product-price-style">{convertPrice price=($product.price / 0.8)}</span> 

just before <span class="price">....

 

The 0.8 is for a 20% discount (100% - 20% = 1 - 0.2 = 0.8). For 15% you should use 0.85, for 30% use 0.7.

 

Now at the products list page you can see the old price and the new price of each product.

 

Similar open the product.tpl file and at line 179 add this

<span class="my-old-product-price-style">{convertPrice price=($productPriceWithoutRedution/0.8)}</span>

just after <span class="our_price_display">

 

With this addition you will be able to see the old price at the product's details page.

 

Don't forget to restore the cache settings at Preferences-> Performance and set Force compile = "No" and Cache = "Yes".

 

That worked for me and I hope it will be usefull to somenone else!

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hi

I cannot get the group discount working. Basically, I create a customer group and apply 10% for all items. I create a test user and assign it under the customer group. However, the product price at the store is still no change. Is there any specific trick I need to know to make it work?

 

I am using Prestashop 1.4.6.

 

Please help.

Link to comment
Share on other sites

×
×
  • Create New...