format price decimal

Posted: September 20, 2010 in Magento, Version 1.3.*, Version 1.4.*

Hello ,
If you wand to display price with/without decimal points
here is the solution

$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
$currency= Mage::getModel(‘directory/currency’)->load($currency_code);
echo $currency->formatPrecision(PRICE,DECIMAL NUMBERS);

if we have to diplay $480.00 as $480 simply use
echo $currency->formatPrecision(480,0);

if we have to display $480.00 as $480.0000 simply use
echo $currency->formatPrecision(480,4);

I hope this will help you….

Thanks ..
Bijal Bhavsar 🙂

Advertisements
Comments
  1. Sudipta says:

    Yes it works, Thanks Man

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s