folkifoon Posted September 22, 2014 Share Posted September 22, 2014 I have this in my invoice template:{Tools::ps_round($order_detail.unit_price_tax_excl,2)}but when a product's price is € 45, it wont show € 45,00How can i change the above code so it always shows the two digits after the comma, so two zeo's?Thanks Link to comment Share on other sites More sharing options...
NemoPS Posted September 22, 2014 Share Posted September 22, 2014 You can change it to php's default number_format($value, 2); or modify the ceilf and floorf methods in tools.php public static function ceilf($value, $precision = 0) { $precision_factor = $precision == 0 ? 1 : pow(10, $precision); $tmp = $value * $precision_factor; $tmp2 = (string)$tmp; // If the current value has already the desired precision if (strpos($tmp2, '.') === false) return ($value); if ($tmp2[strlen($tmp2) - 1] == 0) return $value; return ceil($tmp) / $precision_factor; } 1 Link to comment Share on other sites More sharing options...
folkifoon Posted September 22, 2014 Author Share Posted September 22, 2014 Hi Nemo,But if i just want to change the code in the invoice.tpl, what should, what should that be? <td style="text-align: centre; width: 10%; white-space: nowrap;"> {if $tax_excluded_display} {Tools::ps_round($order_detail.unit_price_tax_excl,2)} {else} {Tools::ps_round($order_detail.unit_price_tax_incl,2)} {/if} </td> Link to comment Share on other sites More sharing options...
NemoPS Posted September 22, 2014 Share Posted September 22, 2014 {$number|string_format:"%.2f"} 1 Link to comment Share on other sites More sharing options...
folkifoon Posted September 22, 2014 Author Share Posted September 22, 2014 thanks!! Link to comment Share on other sites More sharing options...
CSEpe Posted January 28, 2015 Share Posted January 28, 2015 (edited) Thanks for the hint Nemo.This is for the supply order: https://www.prestashop.com/forums/topic/395756-supply-order-decimals/ Edited January 28, 2015 by CSEpe (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts