I need to round the products prices with precision 2, but with the last decimal equal to 0 or 5.
Example:
16,50€
76,70€
5,05€
Inserted prices have precision 4.
16,5963 need to be -> 16,60
16,5388 need to be -> 16,55
How can I do it?
currencyrounding
I need to round the products prices with precision 2, but with the last decimal equal to 0 or 5.
Example:
16,50€
76,70€
5,05€
Inserted prices have precision 4.
16,5963 need to be -> 16,60
16,5388 need to be -> 16,55
How can I do it?
Best Answer
Magento way of generating a price with currency symbol:
Note that you need to pass false as the third argument if you don't want to returned price to have a containing
<span class="price">
element - both the second and third arguments are true by default.Non Magento way to just format a float value for 2 decimal places: