M
M
Mark2017-08-31 06:14:21
opencart
Mark, 2017-08-31 06:14:21

In the online store, the total amount of the order is incorrectly calculated, how to fix it?

In the shopping cart, the cost of the purchase is incorrectly calculated when the item you buy is not a multiple of a whole number.
For example, 29.5 m2 or 29.3 m2, etc. In the basket, the total amount is incorrectly calculated.
Where is the mistake? CMS OpenCart 1.5.5.
Screenshots:
1) prntscr.com/gf7kny
2) prntscr.com/gf7l2m
19.5*669.98=13064.61
Why does the website total: 13,064.66 ? and so he makes a mistake either by 10 kopecks, then by 6 kopecks, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Johnny Smith, 2017-08-31
@Olek1

Tell him to initially replace float with integer in kopecks and millimeters

when you buy a product that is not a multiple of a whole number.
For example, 29.5 m2 or 29.3 m2, etc.

because this is not 29.5 or 29.3 m2, but 29500 and 29300 millimeters, which then must be automatically converted by you into meters.
The loot cannot be considered a float. This data type is very unpredictable unless you carefully study how it works.
PS Therefore, even architects often take millimeters as the minimum unit in their design systems.
Well, or at least let him use double or long double

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question