Patrick Proot Posted May 19, 2016 Share Posted May 19, 2016 Hi I want to know if it is possible to display price on the product.tpl PS 1.6.1.5 with a variable number of decimals depending the real value of the price. display : 2.5 if price is 2.5 , 2.55 if price is 2.55, 2.525 if price is 2.525 and 2.5255 if price is 2.5255 I have a table displaying product volume discount with price exc tax and tax inc but can't fix it to display more to 2 decimals {foreach from=$quantity_discounts item='quantity_discount' name='quantity_discounts'} {if $quantity_discount.price >= 0 || $quantity_discount.reduction_type == 'amount'} {$realDiscountPrice=$productPriceWithoutReduction|floatval-$quantity_discount.real_value|floatval} {else} {$realDiscountPrice=$productPriceWithoutReduction|floatval-($productPriceWithoutReduction*$quantity_discount.reduction)|floatval} {/if} <tr id="quantityDiscount_{$quantity_discount.id_product_attribute}" class="quantityDiscount_{$quantity_discount.id_product_attribute}" data-real-discount-value="{convertPrice price = $quantity_discount.price}" data-discount-type="{$quantity_discount.reduction_type}" data-discount="{$quantity_discount.real_value|floatval}" data-discount-quantity="{$quantity_discount.quantity|intval}"> <td>{$quantity_discount.quantity|number_format:0}</td> <td>{convertPrice price=($quantity_discount.price)|floatval}</td> <td> {if ($tax_rate == '0')} {convertPrice price=$quantity_discount.price} {else} {assign var=taxe value=(($tax_rate + 100 ) / 100)} {convertPrice price=($quantity_discount.price * $taxe)} {/if} </td>..... Thanks in advance for your help Link to comment Share on other sites More sharing options...
jayram.idsil Posted May 19, 2016 Share Posted May 19, 2016 Hi Patrick, I understand you are looking for to display variable floating positions in pricing depends what you have entered as pricing. In template floating position can be defined. Prestashop Database already stores pricing data up to 6 floating positions. Thanks, Jay Link to comment Share on other sites More sharing options...
Patrick Proot Posted May 19, 2016 Author Share Posted May 19, 2016 Hi Jay, Thanks for reply I know that in the DB the price is store with 6 digit I want to remove the final decimal zero so the price 3.256000 will be displayed as 3.256 and in this case force the display with 3 decimal even if my PS is setup to show 2 by default but If not possible to remove the ending zero how to force the price with digital 4 digits ? Best regards Link to comment Share on other sites More sharing options...
jayram.idsil Posted May 19, 2016 Share Posted May 19, 2016 Hi Patrick, If you just want to force to display certain floating positions, you can use {$number|string_format:"%.2f"} here you can change 2f for your requirement. right now 2f means 2 floating positions. To remove ending zeroes, You may have to put some custom script. Jay 1 Link to comment Share on other sites More sharing options...
Patrick Proot Posted May 19, 2016 Author Share Posted May 19, 2016 Have made change on the product.tpl empty the cache but seems don't work price are allways displayed with 2 decimals. Maybe the change must be done also in another place (function convertPrice price or css file) will try to investigate to see where this could be find... Thanks again for any suggestion 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