[TYPO3-commerce] Save price of an article as float instead as integer
Andre Dittmar
typo3 at hotbytes.de
Thu Dec 13 14:18:19 CET 2007
Hello list,
Hopefully someone will give me some needful advice about this issue.
We have a special request of a customer to change the format of
entering the prices. Therefore we need to store the prices as float
instead as integer in the database. We know that this might be not
best practice, and we also know that there might be rounding
differences due periods in the resulting price.
The problem is, that the customer want to keep this practice, because
they also used it this way in the old shop system.
It would be nice if someone could give me a hint about the complexity
and what we have to consider to archieve a preferably proper solution
(e.g. to allow proper updates of the extension in the future).
I try to explain that on the basis of a example.
Some products have:
-> prices for bundles, like 3000 pieces costing 1390,- Euro.
-> price scales, see below
The shop customer always enters the amount in a textfield, so it might
also be possible to order 3250 pieces.
"Product A"
3.000 St./1.390,00 Euro (price per unit: 0,46333333) -> already seems
to be a periodic!
5.000 St./1.895,00 Euro (price per unit: 0,379)
7.000 St./2.480,00 Euro (price per unit: 0,35428571)
At the moment the first price will be stored as 0,46. Therefore if
someone orders 3000 pieces, the price will be 1380,- instead of 1390,-
Euro. Obviously a rounding error, because the missing third to N
missing decimal place.
Again: we're aware of that this might be a problem (even with 10
positions after decimal point in some circumstances). We appreciate
any ideas or help how to solve this most properly...
Thanks & best regards,
Andre
More information about the TYPO3-project-commerce
mailing list