Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Changing the accuracy of internal calculations
 
Jason J
Sr. Member
 
Total Posts:  79
Joined:  2008-05-29
 

I would like to be able to perform all calculations to three or four decimal places, which would include being able to enter tier rates and product prices to that level of accuracy.

Front end display (the shop, invoices, etc.) should remain rounded to two decimal places.

This seems to list a number of places where code should be changed to achieve this:

http://www.magentocommerce.com/boards/viewthread/16337/

However, this is several years old and for a much earlier version of Magento. Is there a more up-to-date guide for making this kind of change, or do all those suggestions still apply?

-- Jason

 
Magento Community Magento Community
Magento Community
Magento Community
 
creativereason
Jr. Member
 
Total Posts:  4
Joined:  2009-08-05
 

I’ve had this same issue, the steps in the old forum you linked to (pre 1.4.0) worked, but it didn’t change the final shopping cart back to 2 decimal places… Something I’m still working on doing unless someone else has suggestions on how to make this easier?

If I figure it out, I’ll post an update.

 
Magento Community Magento Community
Magento Community
Magento Community
 
creativereason
Jr. Member
 
Total Posts:  4
Joined:  2009-08-05
 

I think I found the right spot to fix this (haven’t tested on 1.4.0 and it will require further testing, but it’s 2:21 AM my time right now).

in /app/code/core/Mage/checkout/helper/Data.php go to around line 58 and edit the code to be this:

public function formatPrice($price)
{
        
//return $this->getQuote()->getStore()->formatPrice($price);
        
return number_format($price2"."",");
}

I followed all of the other steps on the previous thread and made this edit… As of right now, my tier pricing shows up 4 decimals as does my minimum price, but my totals show up two digits.

I’ll need to confirm proper rounding and see how it’s saved in the DB, but this is further along than the previous thread detailed.

Obviously you shouldn’t change the core, you should create a local version, etc.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top