How to make prices rounded, without decimals, just in frontend.
And keep backend (admin) with decimals.
For example i have default currency Czech Koruna. which is need to be in XXX.YY format in backend (admin). And in front end it should be XXX format, with out YY.
Thanks a lot.
|
|
Hello;
Go to : system-> Localisation ->currencies
then edit the default or ther currencies by remove the number in “Decimal Places” or make it “0″.
good luck
sam
|
|
Yes thats right, BUT if i put there 0, then invoices not showing decimals, which is must be there.
|
|
but, I think that the customer pay what he see, so when customer see XXX he will pay XXX not XXX.YY
|
|
thats a bit tricky, coz in Czech Republic they dont have decimals in prices, but when you calculate VAT it coming with decimals. so stores put rounded prices on their pages, and give you detailed invoice with decimals, which is in the end rounded.
something like that:
-
This reply was modified 4135 days ago by neivel.
-
This reply was modified 4135 days ago by neivel.
-
This reply was modified 4135 days ago by neivel.
-
This reply was modified 4135 days ago by neivel.
|
|
Hello;
Ok; do this :
open this file:
system/library/currency.php
find this line
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
and replace it by this
$string .= number_format(round($value, 0), (int)$decimal_place, $decimal_point, $thousand_point);
good luck
Sam
|
|
yes, played with it and:
in my case i create second format function in currency.php, and changed sub-total & tax modules and point them to this function.
and result is exactly what i was looking for.
BIG thanks for support!
|
|
for sure there is better solution for this, i just dont have enough knowledge to write properly “if-else”.
must be something like:
if (currency = ‘czk’) {
$string .= number_format(round($value, 0), (int)$decimal_place, $decimal_point, $thousand_point);
} else {
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
).
because it shouldn’t affect another currencies.
if you know please help.
|
|
Good it works for you.
for using another currencies with CZK currency do this :
if ($currency=='CZK') {
$string .= number_format(round($value, 0), (int)$decimal_place, $decimal_point, $thousand_point);
} else {
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
}
good luck
Sam
|
|
Super thanks!
Mark topic as [Solved]
|
|
Hi,
We will move this in the “How to” section
BR,
ThemeBurn team
|
|