chien Posted September 5, 2016 Share Posted September 5, 2016 hi, i would like to display percentage discount instead of 'SALE' on product.tpl page. prestashop v:1.6.1.5 <div id="image-block" class="clearfix"> <div class="badges"> <!--{if $product->new}<span class="ico-product ico-new"><span class="ico-new">{l s='New'}</span></span>{/if}--> {if $product->on_sale} <span class="ico-product ico-sale"><span class="ico-sale">{l s='SALE!'}</span></span> {elseif $product->specificPrice && $product->specificPrice.reduction && $productPriceWithoutReduction > $productPrice} <span class="ico-product ico-sale"><span class="ico-sale">{l s='SALE!'}</span></span> {/if} </div> Link to comment Share on other sites More sharing options...
tdr170 Posted September 5, 2016 Share Posted September 5, 2016 This should already be part of the Product.tpl look in the prices section for this code. <p id="reduction_percent" {if $productPriceWithoutReduction <= 0 || !$product->specificPrice || $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}>{strip} <span id="reduction_percent_display"> {if $product->specificPrice && $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if} </span> {/strip}</p> Link to comment Share on other sites More sharing options...
chien Posted September 6, 2016 Author Share Posted September 6, 2016 But it display out the amount instead of percentage. <p id="reduction_percent" {if !$product->specificPrice || $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}> <span id="reduction_percent_display"> {if $product->specificPrice && $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if} </span> </p> <p id="reduction_amount" {if !$product->specificPrice || $product->specificPrice.reduction_type != 'amount' || $product->specificPrice.reduction|floatval ==0} style="display:none"{/if}> <span id="reduction_amount_display"> {if $product->specificPrice && $product->specificPrice.reduction_type == 'amount' && $product->specificPrice.reduction|floatval !=0} -{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval} {/if} </span> </p> this is what in my product.tpl Link to comment Share on other sites More sharing options...
tdr170 Posted September 6, 2016 Share Posted September 6, 2016 When you created the specific price did you use percent or amount from the drop down. Link to comment Share on other sites More sharing options...
chien Posted September 6, 2016 Author Share Posted September 6, 2016 amount. but i would want to convert that amount into percentage 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