Total is now 4 decimal places vs 2.
Just upgraded from 1.5.4 to 1.5.7. Php was 5.3 now 7.4. In 1.5.4 all of the totals in the orders table under the column order_total were 2 decimal places and the remaining 2 decimal places were always 00. For example an order_total was 16.11 under version 1.5.4. Now under version 1.5.7 an order_total can be 16.1134. I cannot find in configuration how to limit an order total to only 2 digits and not 4 digits after the decimal. Where do I find this?
Thank you,
Re: Total is now 4 decimal places vs 2.
Admin>Localization>currencies is where the decimal places for each currency are stored.
1 Attachment(s)
Re: Total is now 4 decimal places vs 2.
I have that set at 2 decimals. Should it be set at 0?
Attachment 20431
Re: Total is now 4 decimal places vs 2.
An order-total's 'value' field, for as long as I can remember has been stored with a 4-digit decimal. That field's definition in the database is decimal(15,4).
4 Attachment(s)
Re: Total is now 4 decimal places vs 2.
Quote:
Originally Posted by
lat9
An order-total's 'value' field, for as long as I can remember has been stored with a 4-digit decimal. That field's definition in the database is decimal(15,4).
Old database that was running 1.5.4 had the field order-total's 'value' field set to 2-digit decimal.
Attachment 20435
The new database in 1.5.7 has the order-total's 'value' field set to 4 digit decimal.
Attachment 20434
which is causing issues in the database...
Attachment 20437
because when we return information from that table's field it is now not in US dollars but in fractions to the ten thousandths of a dollar.
As posted in a previous comment, the Admin>Localization>currencies is set to 2 decimals.
Attachment 20436
How do I get zen-cart to resume saving amounts in the 2 decimal format?
Re: Total is now 4 decimal places vs 2.
As lat9 has mentioned, that field is decimal(15,4) by default. When in phpMyAdmin, simply click the Change button next to order_total row and set its length to 15,2
Re: Total is now 4 decimal places vs 2.
Quote:
Originally Posted by
balihr
As lat9 has mentioned, that field is decimal(15,4) by default. When in phpMyAdmin, simply click the Change button next to order_total row and set its length to 15,2
This doesn't cause insertion errors when trying to insert 4 decimal places and there is only accepted? Seems like there would be an actual place in the code that would limit output to the number of decimals used in your currency and that would be the place to start looking.
Re: Total is now 4 decimal places vs 2.
Quote:
Originally Posted by
southshorepizza
This doesn't cause insertion errors when trying to insert 4 decimal places and there is only accepted? Seems like there would be an actual place in the code that would limit output to the number of decimals used in your currency and that would be the place to start looking.
Give it a try and let us know. :wink:
It will simply drop the last two digits while inserting. No need to adjust code if this will do the trick.