Jump to content

Resolved - Add 'comma' as Thousands Separator


mitchellds

Recommended Posts

Version: CubeCart 5.1.4

All product pricing information in my installation of CubeCart is displayed without the thousands separator (the comma).

For example, if a product has a price of eleven thousand dollars, my CubeCart environment displays this as $11000.00

What I want is for my CubeCart environment to display $11,000.00

Anyone have an idea on how to get this problem fixed?

Link to comment
Share on other sites

Welcome mitchellds! Glad to see you made it to the forums.

Trust me, CC5 is supposed to display money amounts with thousands separators and decimal points.

It appears we need to figure out why your installation of CC5 isn't.

At a start, we need to know specifically where you are not seeing the formatted price: the View Product page, the admin's Add/Edit Product screen, the emails, the order summary, or everywhere.

Follow that with letting us know what skin you are using and if you have made any edits to the code.

Let's start by looking at the file /class/tax.class.php, at about line 238. Here is what gets done to the price if we are not hiding it.

We will either use PHP's money_format() or number_format() functions.

The first is used if PHP is aware of the server's local environment (maybe would be inappropriate) and the customer is using that very same currency.

Otherwise the second function is used. This function, number_format() requires a symbol to use as the thousands separator. The thousands separator will be either a comma or a period. Not nothing.

I will look at the code that generates all the product's info to display on the View Product page.

In the meantime, double check your copy of this file for me.

Link to comment
Share on other sites

Here's what I would like for you to do:

Open this file for editing: /classes/tax.class.php, lines 243 and 244.


$symbol = ($this->_currency_vars['symbol_decimal']) ? ',' : '.';

return $this->_currency_vars['symbol_left'].number_format($this->priceCorrection($price), $this->_currency_vars['decimal_places'], $symbol, '').$this->_currency_vars['symbol_right'];





Replace those two lines with these:



$symbol_d = ($this->_currency_vars['symbol_decimal']) ? ',' : '.';$symbol_t = (!$this->_currency_vars['symbol_decimal']) ? ',' : '.';

return $this->_currency_vars['symbol_left'].number_format($this->priceCorrection($price), $this->_currency_vars['decimal_places'], $symbol_d, $symbol_t).$this->_currency_vars['symbol_right'];

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...