View Issue Details

IDProjectCategoryView StatusLast Update
0005800OXID eShop (all versions)1.03. Basket, checkout processpublic2014-06-27 13:42
Reporterddpkts Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionno change required 
Summary0005800: Wrong prices inserted into DB when finishing order, when default locale is changed in PHP
DescriptionIf I change locale (LC_ALL or at least LC_NUMERIC) in php:

setlocale(LC_ALL, "lt_LT.utf8") // lt_LT, de_DE, etc.

Numbers' decimal separator becomes comma (,) instead of dot (.)

oxPrice object returns comma separated price values:

oxPrice Object
(
    [_dBrutto:protected] => 11,9
    ...
)

delivery costs oxprice object:

oxPrice Object
(
    [_dBrutto:protected] => 7,9
    ...
)


When finishing/confirming order and inserting into DB, cents are being lost:

e.g.

oxorder sql insert:

Insert into oxorder set ... oxtotalnetsum = '9,83',oxtotalbrutsum = '11,9',oxtotalordersum = '19,8',oxartvat1 = '21',oxartvatprice1 = '2,07', ... oxdelcost = '7,9',oxdelvat = '21' ...;

oxorderarticles sql insert:

Insert into oxorderarticles set ... oxnetprice = '9,83',oxbrutprice = '11,9',oxvatprice = '2,07',oxvat = '21', ... oxprice = '11.9',oxbprice = '11,9',oxnprice = '9,83', ... oxweight = '0.9', ... ;

And I think you know what happens when you try to insert X,XX formatted numbers into MySQL.

oxPrice should return dot separated prices.
Steps To Reproduceset locale e.g. in config.inc.php:

setlocale(LC_ALL, "lt_LT.utf8"); // or de_DE.utf8
Additional Informationlocale should be installed in server, to check if present:
> locale -a

to install:
> locale-gen lt_LT.utf8
TagsNo tags attached.
ThemeAzure
BrowserAll
PHP Versionany
Database Versionany

Activities

Linas Kukulskis

2014-06-27 13:42

reporter   ~0009988

OXID correct set locales in php layer. for example for date format use functions in oxLang class or other utils from oxutils* classes.