I have a problem with field ‘final_price’ in the table ’orders_products’.
There are 2 price fields in this table: products_price (shows the price as 4.1322) and final_price (showing the price as 4.000). Every decimal is set to 0.
Both fields have the same structure in de database, so I guess the problem is not in de database but somewhere in de code.
I made some minor (documented) core-code changes and changes in the database (extra fields in products and products_description).
I guess it has to do with a format of the ‘final_price’ value before it is updated in the database, but I just can’t find the place where this is done.
Can anyone point me in the right direction or give me a tip to fix this?
Thanks in advance.
products_price vs final_price in orders_products
Re: products_price vs final_price in orders_products
Unfortunately, I didn't have time to continue with the site, but in the meantime started again for a while. Unfortunately I haven't been able to solve the problem yet.
The website in question has 3 languages. I tested with the purchase of the same product in all three different languages, everything with the same shipping, the same address, country (and therefore VAT rules) etc.
With the English language the order goes well and both fields are the same in the database. Things go wrong with Dutch and German. There the products_price and final_price are different. The result is that the invoices in these languages do not show the correct amounts and I have to manually change the fields in the database to get the invoice right.
Can someone tell me why filling an amount in the database depends on the language of the website? Can someone help me to find the solution (point me in de right direction)?
Version is CE Phoenix v1.0.8.18, PHJP 7.4.9 (Zend 3.4.0), Addons: Ultimate_SEO_Urls v3.0.5, ZipurFavoriteCountries, Store_Mode_1.4.4, Maths Recaptcha and the language packs for Dutch and German.
The website in question has 3 languages. I tested with the purchase of the same product in all three different languages, everything with the same shipping, the same address, country (and therefore VAT rules) etc.
With the English language the order goes well and both fields are the same in the database. Things go wrong with Dutch and German. There the products_price and final_price are different. The result is that the invoices in these languages do not show the correct amounts and I have to manually change the fields in the database to get the invoice right.
Can someone tell me why filling an amount in the database depends on the language of the website? Can someone help me to find the solution (point me in de right direction)?
Version is CE Phoenix v1.0.8.18, PHJP 7.4.9 (Zend 3.4.0), Addons: Ultimate_SEO_Urls v3.0.5, ZipurFavoriteCountries, Store_Mode_1.4.4, Maths Recaptcha and the language packs for Dutch and German.
-
- VIP Member
- Posts: 44
- Joined: Mon Oct 26, 2020 4:56 pm
- Has thanked: 1 time
- Been thanked: 2 times
Re: products_price vs final_price in orders_products
Hi,
I think this is a result of LC_ALL in the main language files for example: english.php
where there is no problem.
But LC_ALL also sets LC_MONETARY to [mon_decimal_point] => ,
for many languages. That is where the problem lies.
https://www.php.net/manual/en/function.setlocale.php
So I set it only for time in my german.php language file:
Got me rid of the problem.
Kind regards
Christoph
I think this is a result of LC_ALL in the main language files for example: english.php
Code: Select all
@setlocale(LC_ALL, ['en_US.UTF-8', 'en_US.UTF8', 'enu_usa']);
But LC_ALL also sets LC_MONETARY to [mon_decimal_point] => ,
for many languages. That is where the problem lies.
https://www.php.net/manual/en/function.setlocale.php
So I set it only for time in my german.php language file:
Code: Select all
@setlocale(LC_TIME, ['de_DE.UTF-8', 'de_DE.UTF8', 'deu_deu']);
Kind regards
Christoph
Re: products_price vs final_price in orders_products
Hi Christoph,
I cannot thank you enough for this solution. Made the adjustment in both language files and it works great.
Kind regards
Harald
I cannot thank you enough for this solution. Made the adjustment in both language files and it works great.
Kind regards
Harald
Re: products_price vs final_price in orders_products
final_price - german, the problem starts with install Addon Ultimative SEO Urls, by using only one language german.
Thanks to Harald (dankjewell) for take me here and thank you very much Christoph for the fix
Thanks to Harald (dankjewell) for take me here and thank you very much Christoph for the fix