prestalearn Posted December 27, 2013 Share Posted December 27, 2013 I have qty discount on some of my products and I would like to show the final price instead of the discount in the product page. Is there someone who knows how I can modify product.tpl to show this? Now it looks like this: Product From Discount Ice 10 -5$ Ice 20 -10$ Instead I would like it to show what the actual price (per unit) is when purchasing 10 pieces, 20 pieces etc. Happy for any help! Link to comment Share on other sites More sharing options...
NemoPS Posted December 28, 2013 Share Posted December 28, 2013 I think you need to do some math: <td> {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'} -{convertPrice price=$quantity_discount.real_value|floatval} {else} -{$quantity_discount.real_value|floatval}% {/if} </td> Find the above and change it to <td> {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'} {math equation="a-b" a=$productPriceWithoutReduction b=$quantity_discount.real_value|floatval assign=final_disc_price} {convertPrice price=$final_disc_price} {else} {math equation="a*b/100" a=$productPriceWithoutReduction b=$quantity_discount.real_value assign=disc_value} {math equation="a-b" a=$productPriceWithoutReduction b=$disc_value assign=final_disc_price} {convertPrice price=$final_disc_price} {/if} </td> It should work 1 Link to comment Share on other sites More sharing options...
prestalearn Posted January 27, 2014 Author Share Posted January 27, 2014 That is perfect Nemo1. You are fantastic resource for the prestashop community! Link to comment Share on other sites More sharing options...
PrestaShark Posted September 4, 2014 Share Posted September 4, 2014 (edited) I think you need to do some math: <td> {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'} -{convertPrice price=$quantity_discount.real_value|floatval} {else} -{$quantity_discount.real_value|floatval}% {/if} </td> Find the above and change it to <td> {if $quantity_discount.price >= 0 OR $quantity_discount.reduction_type == 'amount'} {math equation="a-b" a=$productPriceWithoutReduction b=$quantity_discount.real_value|floatval assign=final_disc_price} {convertPrice price=$final_disc_price} {else} {math equation="a*b/100" a=$productPriceWithoutReduction b=$quantity_discount.real_value assign=disc_value} {math equation="a-b" a=$productPriceWithoutReduction b=$disc_value assign=final_disc_price} {convertPrice price=$final_disc_price} {/if} </td> It should work Yes it is! Any idea how to update quantity discounted price when the base price is change (incease price via attribute) ? Here is demo http://zazl.linuxpl.info/test/index.php?id_product=1&controller=product Quantity price reduction 26+ pcs, -10% from base price 100+ pcs, -20% from base price Base price is: 100zł for NANO 8GB (no price change by attibute) 110zł for NANO 16GB (+10zł set by attribute) 120zł for NANO 32GB (+20zł set by attribute) So the table should looks like here for NANO 8GB - all ok od 1+ szt. 100,00 zł od 26+ szt. 90,00 zł od 100+ szt. 80,00 zł NANO 16GB - not ok after change attribute should be this: od 1+ szt. 110,00 zł od 26+ szt. 99,00 zł (base price 110zł - 10% of the quantity discount) od 100+ szt. 88,00 zł (base price 110zł - 20% of the quantity discount) NANO 32GB - not ok after change attribute should be this: od 1+ szt. 120,00 zł od 26+ szt. 108,00 zł (base price 120zł - 10% of the quantity discount) od 100+ szt. 96,00 zł (base price 120zł - 20% of the quantity discount) System work fine and the price in cart is correct So if i choose 100+ pcs of NANO 32 GB the price will be 9,600zł So this is only script/function magic Any ideas? I can pay for this solution. Thanks in advance! Edited September 4, 2014 by PrestaShark (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted September 5, 2014 Share Posted September 5, 2014 Hm, complex. I think you have to work a bit on the function findCOmbination() of the product.js file, so that you update the discounts price block too. I didn't try it, but I thought it was supposed to work if you added specific prices for combinations, no? Link to comment Share on other sites More sharing options...
PrestaShark Posted September 5, 2014 Share Posted September 5, 2014 Hm, complex. I think you have to work a bit on the function findCOmbination() of the product.js file, so that you update the discounts price block too. I didn't try it, but I thought it was supposed to work if you added specific prices for combinations, no? Hi! Do You accept the challenge then? I can pay for Your help Nemo Name Your price and PM me. Link to comment Share on other sites More sharing options...
NemoPS Posted September 6, 2014 Share Posted September 6, 2014 I'm sorry but I can't take care of it personally at the moment Link to comment Share on other sites More sharing options...
PrestaShark Posted September 8, 2014 Share Posted September 8, 2014 I'm sorry but I can't take care of it personally at the moment Hi, Nemo, No problem. I understand it very well! Link to comment Share on other sites More sharing options...
PascalVG Posted September 27, 2014 Share Posted September 27, 2014 N.B., instead of changing the product.tpl with Nemo's code, there is already an option built-in in the product.tpl code to show the discounted price instead of the discount in amount or in %. To get this, change in the database PS_DISPLAY_DISCOUNT_PRICE to 1 So run the following sql code in phpMyAdmin or so (Assumed is that your db prefix is ps_ , change accordingly) UPDATE `ps_configuration` SET `value`=1 WHERE `name`= "PS_DISPLAY_DISCOUNT_PRICE" This will give you the discounted price. (refresh the product detail page) FYI, pascal 2 Link to comment Share on other sites More sharing options...
PascalVG Posted September 30, 2014 Share Posted September 30, 2014 Update: I have a 1.5.6.2. (Javascript) version that seems to work as asked for, with example here: http://ps1562.buymethai.com/en/music-ipods/1-ipod-nano.html#/disk_space-16gb/color-black You can play with the attribute and will see the product prices in the quantity discount list be updated. Ask if interested, pascal. Link to comment Share on other sites More sharing options...
hbohem Posted September 30, 2014 Share Posted September 30, 2014 Hi, I need to generate an estimated quantity discount, for example if I buy 3 products about 25% is applied to any product use would be helpful prestashop 1.6 Link to comment Share on other sites More sharing options...
Naldinho Posted September 30, 2014 Share Posted September 30, 2014 PrestaShark, Any luck on finding a solution so that the discount price changes when attributes that impact price are changed? I also would like that feature. It is on my to do list for down the road but if you found a solution then I won't have to bother. Link to comment Share on other sites More sharing options...
PascalVG Posted October 1, 2014 Share Posted October 1, 2014 hbohem, Something like this? If you indeed want it for all products, you can just add a line in themes/<your theme folder>/product.tpl: (Make backup!!!) search for the following code (easy to find when searching for our_price_display) and add the red line: <!-- prices --> <div class="price"> <p class="our_price_display" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> {if $product->quantity > 0}<link itemprop="availability" href="http://schema.org/InStock"/>{/if} {if $priceDisplay >= 0 && $priceDisplay <= 2} <span id="our_price_display" itemprop="price">{convertPrice price=$productPrice}</span> <div id="our_price_display_3_pcs" class="3_quantity" itemprop="3_quantity_discount_price.">(3 pcs for {convertPrice price=($productPrice*.75)})</div> It then just adds the extra line below the normal '1 piece' price. As you can see, I just multiply the normal price with .75 to get a 25% discounted price. You can add some css code to the end of the themes/<your theme folder/css/global.css file to do some 'line decoration': .3_quantity { // add your css code here } N.B. To really get the quantity discount, you can add a general price rule over all categories that does just this. Hope this helps, pascal. Naldinho, see PM for details. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now