[TYPO3-commerce] Save price of an article as float instead as integer
ingo schmitt
mailinglisten at i-schmitt.de
Sun Dec 30 19:33:17 CET 2007
Hi Andre,
if you do want to switch to float values, you'll have to:
+Change the Database fields for prices and baskets
+Change the hooks (DM Hooks + CM Hooks) which convert the decimal values
to integer values by multiplying 1000
+Have a look at the methods, for calculation of the values
+Check the statistics calculation.
To be honest, I don't think this is a good idea, maybe you could have a
look at the price scales. You could define 0,46 for one pice, and e.g.
1390,- for 3000 pieces. If you make the scales small, you won't get any
problem...
Ingo
> 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
>
Mit freundlichen Gruessen
--
Ingo Schmitt mailto:is at marketing-factory.de
Marketing Factory Consulting GmbH http://typo3.marketing-factory.de/
Content Management mit Typo3: Beratung - Schulung - Realisierung
More information about the TYPO3-project-commerce
mailing list