MaxPayne Posted February 10, 2014 Share Posted February 10, 2014 Hello, prompt please how show discount in percent on product_list. Thanks in advance Link to comment Share on other sites More sharing options...
PascalVG Posted February 11, 2014 Share Posted February 11, 2014 Hi Max, probably something like this: (Put code somewhere appropriately inside the {foreach from=$products.....} block) {if $product.price_without_reduction neq $product.price} {if $product.specific_prices} <div class="reduction_corner"> {assign var='pro_specific_prices' value=$product.specific_prices} <span class="reduction_corner_text"> {if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))} -{$pro_specific_prices.reduction * 100|floatval}% {/if} </span> <span class="reduction_corner_price_text"> {if $pro_specific_prices.reduction_type neq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))} -{number_format($pro_specific_prices.reduction, 0 , ',' , ' ')},- {* !!!PAs, no decimals and symbol in reduction amount *} {/if} </span> </div> {/if} {/if} (Added for non-percentage as well, to be complete). My 2 cents, pascal (N.B. Code once made to add a funny reduction-corner in the top-left of the product, so that's where the 'corner' div/span names come from :-) ) 2 Link to comment Share on other sites More sharing options...
mellowman Posted June 30, 2014 Share Posted June 30, 2014 Hi Max, probably something like this: (Put code somewhere appropriately inside the {foreach from=$products.....} block) {if $product.price_without_reduction neq $product.price} {if $product.specific_prices} <div class="reduction_corner"> {assign var='pro_specific_prices' value=$product.specific_prices} <span class="reduction_corner_text"> {if $pro_specific_prices.reduction_type eq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))} -{$pro_specific_prices.reduction * 100|floatval}% {/if} </span> <span class="reduction_corner_price_text"> {if $pro_specific_prices.reduction_type neq 'percentage' && ($pro_specific_prices.from eq $pro_specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $pro_specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $pro_specific_prices.from))} -{number_format($pro_specific_prices.reduction, 0 , ',' , ' ')},- {* !!!PAs, no decimals and symbol in reduction amount *} {/if} </span> </div> {/if} {/if} (Added for non-percentage as well, to be complete). My 2 cents, pascal (N.B. Code once made to add a funny reduction-corner in the top-left of the product, so that's where the 'corner' div/span names come from :-) ) This worked smoothly for me on 1.5.6.2 Thanks for sharing Link to comment Share on other sites More sharing options...
prestashopnew Posted February 26, 2016 Share Posted February 26, 2016 This code shows the difference between the full price and the discounted price, not the percentage, any ideas? prestashop 1.6.1.4 Link to comment Share on other sites More sharing options...
MaxPayneNSK Posted March 10, 2016 Share Posted March 10, 2016 This code shows the difference between the full price and the discounted price, not the percentage, any ideas? prestashop 1.6.1.4 if need show % on product_list {if $product.specific_prices.reduction_type == 'percentage'} <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span> {/if} Link to comment Share on other sites More sharing options...
Recommended Posts