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

Page 3 of 3
How do I use more than two decimal places for prices? 
 
goivvy
Guru
 
Avatar
Total Posts:  322
Joined:  2010-12-15
Moscow, Russia
 

try

echo Mage::getModel('sales/order')->formatPrecision($_product->getFinalPrice(), $_your_precision_integer);
 
Magento Community Magento Community
Magento Community
Magento Community
 
cschuler
Jr. Member
 
Total Posts:  3
Joined:  2011-06-23
 

I had to make multiple changes to get this to work.  So many changes in fact, that i can’t post it here (see attachment instead).

A little background....  My company makes small plastic caps and other plastic items.  Some of the items are individually priced at less than a penny.  I therefore needed the ability to price individual items with 4-decimal place pricing.  But I didn’t want this to affect all prices globally, because I want all the totals/subtotals get rounded to normal 2-decimal place dollar amounts.

I did this my adding a “$precision” parameter to several functions, defaulting this parameter to “2”, and by passing a value of “4” wherever I needed 4-decimal place prices.

The attached changes are my “work-in-progress” and have not yet been tested in a production environment, so there are doubtless other changes I’ll need to make before we put our site live. 

I’d really rather turn these changes into a standard magneto mod, but I’m having problems because some of the classes I need to extend have already been extended by some of the other mods I’ve already installed (Drop-down-quantity mod (DDQ), Simple Configurable Products (SCP) ).  Magneto does not allow you to extended the same class twice, so I’m running into conflicts with these other mods.  After my site goes live I might have the time to go back and address these issues.  But for right now, I have a deadline to meet.  smile

File Attachments
decimod.txt  (File Size: 10KB - Downloads: 585)
 
Magento Community Magento Community
Magento Community
Magento Community
 
spanakorizo
Jr. Member
 
Total Posts:  28
Joined:  2009-12-14
 

Hi cschuler,
do you know how to change also the invoice decimals?
they will need to be displayed in 2 , now with all the changes they will display 4

 
Magento Community Magento Community
Magento Community
Magento Community
 
cschuler
Jr. Member
 
Total Posts:  3
Joined:  2011-06-23
 

My invoices still only show 2 decimals.  The only thing my mod does is change the unit price to display with 4 decimals (and it only changes the unit display in a handful of places).  My invoices don’t display the individual unit prices at all, rather only shows a total for each line item, and is therefore not affected by the above changes.

Are you saying that your Invoice line items display with 4 decimal places?  if so, did you apply any of the other mod suggestions from other people in this thread?  AFAIK, my mod wouldn’t do that (unless I’m missing something).

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 3 of 3