Showing “Total Discount” in Prestashop Cart

September 17, 2014 Alex Simonchik Prestashop, Tips&Tricks
Showing “Total Discount” in Prestashop Cart

In this article we are going to describe how you can show your customers how much they have saved by purchasing goods at a discounted price.  We will also show how to calculate and output total buyer’s savings onto the shopping cart page.

1Total Discount

So first, we will need to customize the template ‘shopping-cart.tpl’

We will use the following code to output the total discount in the shopping cart:

To correctly output html, you need to take into account this additional line that displays the total sum of the discount:

Here you can try out the working sample.

Here you can also download the template file “shopping-cart.tpl“.



16 comments

  1. Hi Alex, first of all, thanks for your tutorials.Hi Alex, first of all, thanks for your tutorials and help.

    I have found a mistake, if you select in your demo the product “Blouse (demo_2)” and you go to the cart, you can see the product with the discount you have in the catalogue (10%), but you can see in the line of “Total discount” 11%. You are calculating this percentage from the price ($27) not from the final price (discount included) ($24,30). If you buy more than 1 product, the same mistake.

    Regards.

    Goyo.

  2. Hello man, I’ve a issue, I would like to know how to change (increase) order total price in shopping cart. Are there methods? I tried updating some Javascript variables, but it’s not result well. Can you help me?

    Thanks a lot

  3. Franklin Ruiz,

    Can you please specify why do you need to know this? Order total is the total sum of all products + shipping – discount coupon etc. You need to know all summands that make the total sum.

  4. Thanks for the article and tutorial. It works until you change the quantities and then there is no update to the total saving. Can you solve this?

  5. MD,

    It’s just an example, in order to work with ajax-based shopping cart, you also need to make changes in the .js files in your theme.

  6. this is perfect but can you please show us how tu modify the .js file? please thanks

  7. This is awesome. I’m looking for a way to add the total before discount to the invoice and the total discount. Can you help me. I just can’t seem to get it to work.

  8. Hello,
    Can modify like in the way,
    For example we set
    1% for total to 200 $
    2% for total from 300$
    3% from total from 400$
    If sum of order is 250$
    cart automatically calculate sum of discount and says
    You are with 1% discount and get 2,5$
    you have 50$ to discount of 2%
    you have 150$ to discount of 3%

  9. Alex

    I wish to do discount but according the total quantity, I try catalog rues but that only work under each item, my rules will be:
    1.- 3-5 peaces 5% discount
    2.- 5-11 peaces 10% discount
    3.- 12-16 peaces 15% discount
    4.- >16 peaces 20% discount
    This discount apply under the Total Products amount

  10. Hi Can you please show us how tu modify the .js file in default theme? after change qty total_discount not changing, after refresh page show correctly
    please thanks

  11. Hi Ani,
    Thanks for the comment. It’s a good notice, but here it’s necessary to modify not only the js-code, but also php-controller that processes Ajax call which returns parameters after cart refreshing.
    * controller -> cart
    * js/cart-summary.js
    Unfortunately to describe the whole process will require too much time.

Post a new comment

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