Problem currency in EURO


Avatar: stefanofioreintra

2016-03-15 13:14

hi! I'm new of quick cart and I have a problem with the "price" in EURO.
If I put a price as 450.000,00 Euro quickcart show me the price correctly but disappears the button add to cart.
In addition, also it disappears the word "Price" and "Euro" near the price.

how can I truly recognize the euro in quickcart? to me you need the size EUR 300,000.00 with the dot and comma.

thx! I hope you understand

» Quick.Cart v6.x


Avatar: boboo

2016-03-18 18:16

Hello Stefano,

the "problem" is in handling float numbers by php (and all other machines)
The machine understand only the dott "." as a comma.
One and half must be given as "1.5" and not as "1,5"
This problem is well solved by QuickCart, does not a matter if You write in admin panel a price for a product with dott or comma.
The code will make it correct and a good float will be saved (with ".")
(see the normalizePrice function in core/ common.php)
But You should NOT input a price like this: 1.000,00 or this: 1,000.00 (with two signs)
By saving the product data the code is checking first whether the price is_numeric after changing comma to dott.
And this: 1.000.00 is NOT numeric. Too many dotts (only one is in float number allowed).
In this case it will be saved and later shown as string.
And if it is not_numeric, the basket button will remain hidden.
(see throwProduct and listProducts functions in core/product.php)

So, if You want to save correct prices, input them with float comma or dott but WITHOUT 1000's separator.

Now we have good prices, but they should be shown well formatted in the shop view.
For this reason, a function displayPrice (in core/common.php) has been prepared.
Now the function does nothing (just returns a given parameter without any changes).
But You can use this function:
to output (display) the wanted format of the price.
If You want 1.000,00 then exchange in displayPrice

return $mPrice;


return number_format($mPrice,2,',','.');

or if You want 1,000.00 then exchange it to:

return number_format($mPrice,2,'.',',');

But remember, it will be shown only in shop (for customers),
and in Admin panel You can use only 1 sign (dott or comma) for decimals, and NOT for 1000's separator.

boboo :-)

Back to top
about us | contact