Skip to content

Magento : Fixed Issue Price or Total Amount Order More Than 100 Million

When your magento implement in a country with small number digits currency like US or Major Europe countries this issue maybe will not happens, but if your Magento implement in some countries with currency with a lot number of digits like dollar zimbabwe or indonesia rupiah or dong vietnam (conversion from USD).. it will be a problem, i found a way to fix this problem:

 

  1. Edit file app\code\core\Mage\Sales\Helper\Data.php
  2. increase number “const MAXIMUM_AVAILABLE_NUMBER”  to whatever you want, mine change to 99999999999 (almost 1 trillion)
  3. go to your database use Phpmyadmin or adminer or you fav mysql tool
  4. run this query to find all magento tables columns with data type “Decimal”
  5. select TABLE_NAME, COLUMN_NAME,COLUMN_TYPE,COLUMN_KEY from information_schema.columns
    where table_schema = ‘YOUR_DB_NAME’ and data_type= 'decimal'
    order by COLUMN_KEY DESC,table_name,ordinal_position
    
  6. the sql result will be like this
  7. TABLE_NAME	COLUMN_NAME	COLUMN_TYPE
    cataloginventory_stock_item	qty	decimal(12,4)
    cataloginventory_stock_item	min_qty	decimal(12,4)
    cataloginventory_stock_item	min_sale_qty	decimal(12,4)
    cataloginventory_stock_item	max_sale_qty	decimal(12,4)
    cataloginventory_stock_item	notify_stock_qty	decimal(12,4)
    cataloginventory_stock_item	qty_increments	decimal(12,4)
    cataloginventory_stock_status	qty	decimal(12,4)
    
  8. save the query result to excel/csv
  9. open use excel
  10. generate sql script use concatenate excel function
  11. mine use this excel function
  12. =CONCATENATE("ALTER TABLE ",A2," CHANGE ",B2," ",B2," DECIMAL(19,4);")
  13. the function will generate sql script like this
  14. ALTER TABLE cataloginventory_stock_item CHANGE qty qty DECIMAL(19,4);
    ALTER TABLE cataloginventory_stock_item CHANGE min_qty min_qty DECIMAL(19,4);
    ALTER TABLE cataloginventory_stock_item CHANGE min_sale_qty min_sale_qty DECIMAL(19,4);
    ALTER TABLE cataloginventory_stock_item CHANGE max_sale_qty max_sale_qty DECIMAL(19,4);
  15. copy generated sql script, execute on your mysql tools
  16. then reindex & flush cache
  17. voila!! problem solved 🙂

Comments are closed.