Just another WordPress.com weblog

format price decimal

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 ..
Vishal Surani

Advertisements

Comments on: "format price decimal" (1)

  1. 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

%d bloggers like this: