Jump to content

Show the price after discount instead of discounted sum


Recommended Posts

 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

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 :)

  • Like 1
Link to comment
Share on other sites

  • 5 weeks later...
  • 7 months later...

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 by PrestaShark (see edit history)
Link to comment
Share on other sites

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

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

  • 3 weeks later...

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

  • Like 2
Link to comment
Share on other sites

hbohem,

 

Something like this?

post-455771-0-75017100-1412164665_thumb.png

 

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...