Jump to content

[SOLVED] Problem with price formating and multilanguage


Recommended Posts

There is a little problem when using Prestashop in both French and English.
Basically in English and most of languages decimals are separated by a '.' like 1.29$
In French decimals are separated by a ',' like 1,29$

Prestashop can only have one decimals separator for each currency whatever is the language. It makes things a bit confusing for customers.
It would me nice to have an option to choose the decimal separator for each languages.

I made a feature request:
http://www.prestashop.com/bug_tracker/view/5111/
Unfortunately it does not seem to have anyone taking care of the feature requests...

Link to comment
Share on other sites

What I did to solve this problem is to modify the displayPrice function in classes/Tools.php.
In my case I choose case 1 for price format in back office which is like $1,000.05
The main language (id=1) is English and the second is French

Here is the modifications I did:
classes/Tools.php for the displayPrice function
I replaced :

case 1:
$ret = $c_char.$blank.number_format($price, $c_decimals, '.', ',');
break;



with:

case 1:
$langid= intval($cookie->id_lang);
if ($langid=="1"){
$ret = $c_char.$blank.number_format($price, $c_decimals, '.', ',');
}
else {
$ret = number_format($price, $c_decimals, ',', '.').' '.$c_char.$blank; 
}
break;



This way in English price will display this way: $1,000.05
and in French this way: 1.000,05 $

Link to comment
Share on other sites

×
×
  • Create New...