Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: Format price number  (Read 5701 times)

Offline aliciaR

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
  • happy
    • View Profile
    • https://sartenes.top
Format price number
« on: June 07, 2020, 03:21:49 PM »
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
me encanta la cocina y por supuesto el bien comer y como valenciana las buenas paellas con la familia los domingos, aparte me gusta el deporte el cine y la lectura, tambiƩn soy administradora de newbielink:https://sartenes.top [nonactive]

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +299/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Format price number
« Reply #1 on: June 07, 2020, 03:43:49 PM »
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
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5851
  • Karma: +275/-2
    • View Profile
Re: Format price number
« Reply #2 on: June 08, 2020, 01:26:13 AM »

Offline OneMore

  • Newbie
  • *
  • Posts: 46
  • Karma: +12/-0
    • View Profile
Re: Format price number
« Reply #3 on: February 23, 2024, 01:45:13 PM »
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:

Code: [Select]
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
« Last Edit: February 27, 2024, 12:48:51 PM by OneMore »

 

Powered by SMFPacks Social Login Mod