1

Put simply, I need to have pricing accurate to 5 (possibly even 6) digits of precision.

I have come across some generic modules that allow the precision to be 4 digits. Going further, I of course discovered that the MySQL fields are defined as DECIMAL(12,4).

Unfortunately, I require 5-6 places of precision. The pricing formula is simple:

 QUANTITY = WIDTH * HEIGHT (for area based)
 QUANTITY = LENGTH (for linear based)
 TOTALPRICE = QUANTITY * ITEMPRICE + BASE COST

Item prices need to be stored similar to 0.02125.

Given the limitations of Magento, it seems I am faced with a few options.

  1. Hack the core to allow additional precision, including changing the MySQL fields to DECIMAL(12,5) or DECIMAL(12,6).
  2. Add a new text field attribute that won't care about decimal precision and use that for prices instead of the default price field (I'm guessing through an observer).
  3. ???

Given the requirement that prices need to be stored with 5-6 digits of precision, what method might you suggest?

2

I explored option 2. Ultimately I decided that this was not a suitable path to take and am going to instead use custom entity relationships with products to achieve the pricing precision I require.

See answer: Update product custom option price in observer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.