Magento How do I set the product price to 4 decimal places

Viewed 18840

For a UK or Europe store we have to show inc VAT prices. i.e. a product selling for £15.95 on the store front would be stored in the admin as £13.5744 - so that when the VAT(17.5%) is added it will make £15.95

Unfortunately Mag seems to only store the price to 2dp. Even is you enter 13.5744 in the admin for the price - you get 13.57 on refresh.

Is it possible to store admin product price in 4dp and at frontend we show on 2dp?.

Cheers,

4 Answers

There are at least 3 places to replace/overwrite:

  • app/code/core/Mage/Directory/Model/Currency.php (\Mage_Directory_Model_Currency::format)
  • app/code/core/Mage/Core/Model/Store.php (\Mage_Core_Model_Store::roundPrice)
  • app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php (\Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price::getEscapedValue)

and in admin...

  • app/code/core/Mage/Sales/Model/Order.php (\Mage_Sales_Model_Order::formatPrice and \Mage_Sales_Model_Order::formatBasePrice)
  • app/code/core/Mage/Adminhtml/Block/Sales/Items/Renderer/Default.php (Mage_Adminhtml_Block_Sales_Items_Renderer_Default (which extends Abstract.. you must implement displayPrice method))

Also, you can check the module I created to rewrite these classes on github.

https://github.com/r-martins/Magento-PriceDecimals/

Related