News:

AbanteCart v1.4.2 is released.

Main Menu

Format price number

Started by aliciaR, June 07, 2020, 03:21:49 PM

Previous topic - Next topic

aliciaR

Hi, can you tell me please how to change the format of price number from example 44,444 to 44 444 or 44 000.00? Thank you

abantecart

Hello Alicia,

Check this doc:
https://abantecart.atlassian.net/wiki/spaces/AD/pages/15270043/Add+or+Edit+Currency

Also there are some formats in language definition. See attached image


OneMore

#3
As a complement to previous answers, for those who want adding a space between the price and a currency code, this can be done in 'core\lib\currency.php', at at the end of the 'wrap_display_format' function (~ line 237), this way:

public function wrap_display_format($number, $currency = ''){
                (...)
return $symbol_left . $formatted_number .' '. $symbol_right;
}


Example case:
1200.00SEK will become 1200.00 SEK.


Edit on 2024/02/27:

And for those who want to strip decimals only for round numbers, here's how you can implement a "price beautifier":
https://forum.abantecart.com/index.php/topic,10649.msg40957.html#msg40957

Cassie Crane

You can usually handle this with number formatting functions in your code—just set the right thousand separator and decimal style.

Forum Rules Code of conduct
AbanteCart.com 2010 -