1

I wanna set this number 100000000000 to my product price but Magento change it to 100000000 and it doesn't save it correctly

how can I fix it?

magento version 1.9

1

That is because of the limitations of the columns definition in MySQL: The columns where prices are stored are all of type decimal(12,4). That means that you can store only prices with a maximum of 12 digits in total where 4 are digital points. So the maximum value that can be stored is 99999999.9999 and rounded 100000000.

In order to allow greater values you will need to change all the corresponding database fields from decimal(12,4) to something larger. To work with prices of 100000000000 you need at least 4 more digits because the value will be summed for example in checkout process (3 digits would allow a maximum of 99999999999.9999 rounded exactly your required price 100000000000). That would mean to change the affected columns from decimal(12,4) to decimal(16,4)

The MySQL command to perform a change like this for a column is:

alter table [YOUR TABLENAME] modify [YOUR COLUMN] decimal(16,4);

Be aware that there are lots of affected columns in Magentos database!

Starting with value in table catalog_product_entity_decimal (where the price product attributes are stored, going to and the price columns in sales_flat_quote_item,sales_flat_order_item etc. to the total columns in sales_flat_quote,sales_flat_order, sales_flat_order_grid,sales_flat_invoice,sales_flat_invoice_gird etc. (e.g. base_subtotal,subtotal,base_grand_total, grand_total). This list is not complete!

And there may be some more tables / columns affected depending on your maximum order value, tax calculation etc.

You should also be aware that changing database definitions on core Magento fields my cause conflicts with later updates or potential migrations to Magento 2.**

If you want to go that way you should analyze your settings to identify all the needed columns, make the changes in a local / development environment and test them before rolling them out in production!

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.