Jump to content

quantity discount


GomX

Recommended Posts

Hello everyone,

I'm new to prestashop and I found a problem that i don't know how to solve it. I would also quantity discounts, instead of showing the percentage of discount, show me the specific price once the discount applied, ie if I have a product that costs 100 € and for 20 units you there is a 15 % off, show me the price for one unit, ie i want to show 85 € instead of 15%.

Can someone help me, please.?

Thank you,

Link to comment
Share on other sites

Modify line 315 of product.tpl in your theme's directory and change:

-{$quantity_discount.value|floatval}%



to:

{if !$priceDisplay || $priceDisplay == 2}{assign var='price' value=$product->getPrice(true, $smarty.const.NULL, 2)}{else}{assign var='price' value=$product->getPrice(false, $smarty.const.NULL, 2)}{/if}{math assign='discount' equation='x * y/100' x=$price y=$quantity_discount.value|floatval}{convertPrice price=$price-$discount}

Link to comment
Share on other sites

  • 2 months later...

He modificado el codigo para que el listado de descuentos aparezcan por filas.
Tendremos tres columnas llamadas : Cantidad, Descuento y Precio Neto Unidad

>


{if $quantity_discounts}
<!-- quantity discount -->
</pre>
<ul>
{l s='Quantity discount'}
</ul>
<br><div>

{l s='Cantidad'}{l s='Descuento'}{l s='Precio neto unidad'}
       {$quantity_discount.quantity|intval} 
       {if $quantity_discount.quantity|intval > 1}
           {l s='unidades'}
       {else}
           {l s='unidad'}
       {/if}

       {if $quantity_discount.id_discount_type|intval == 1}
           {$quantity_discount.value|floatval}%
       {else}
           {convertPrice price=$quantity_discount.value|floatval}
       {/if}

       {if $quantity_discount.id_discount_type|intval == 1}
           {if !$priceDisplay || $priceDisplay == 2}
               {assign var='price' value=$product->getPrice(true, $smarty.const.NULL, 2)}
           {else}
               {assign var='price' value=$product->getPrice(false, $smarty.const.NULL, 2)}
           {/if}                
           {math assign='discount' equation='x * y/100' x=$price y=$quantity_discount.value|floatval}
           {convertPrice price=$price-$discount}/unidad 
       {else}
           {if !$priceDisplay || $priceDisplay == 2}
               {assign var='price' value=$product->getPrice(true, $smarty.const.NULL, 2)}
           {else}
               {assign var='price' value=$product->getPrice(false, $smarty.const.NULL, 2)}
           {/if}    
           {math assign='discount' equation='x - y' x=$price y=$quantity_discount.value|floatval}            
           {convertPrice price=$discount}/unidad 
       {/if}


</div>
<br>{/if}<br



NO funciona cuando tenemos atributos en el artículo que hacen que varíe el precio de venta.
¿Alguien sabe cómo sería la modificación?
Gracias

Link to comment
Share on other sites

  • 2 months later...
  • 8 months later...
Modify line 315 of product.tpl in your theme's directory and change:

-{$quantity_discount.value|floatval}%



to:

{if !$priceDisplay || $priceDisplay == 2}{assign var='price' value=$product->getPrice(true, $smarty.const.NULL, 2)}{else}{assign var='price' value=$product->getPrice(false, $smarty.const.NULL, 2)}{/if}{math assign='discount' equation='x * y/100' x=$price y=$quantity_discount.value|floatval}{convertPrice price=$price-$discount}



Hello Rocky,

thanks for the code, but it is not working for me. I'm posting my code here, after changing the code to you r solution. perhaps you can tell me, what I'm doing wrong?


           {foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'}

               {if !$priceDisplay || $priceDisplay == 2}{assign var='price' value=$product->getPrice(true, $smarty.const.NULL, 2)}{else}{assign var='price' value=$product->getPrice(false, $smarty.const.NULL, 2)}{/if}{math assign='discount' equation='x * y/100' x=$price y=$quantity_discount.value|floatval}{convertPrice price=$price-$discount} 

           {/foreach}



Thanks again for the help.

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...