Format price in the current locale and currency

I use :

$product->getPrice();

to get the unformatted price that I can calculate "quantity X price" with ajax.

I want to reformat the total in the current locale and currency. How can I do that?


Solution 1:

I think Google could have answered your question ;-) See http://blog.chapagain.com.np/magento-format-price/.

You can do it with

$formattedPrice = Mage::helper('core')->currency($finalPrice, true, false);

Solution 2:

$formattedPrice = Mage::helper('core')->currency($_finalPrice,true,false);

Solution 3:

For formatting the price in another currency than the current one:

Mage::app()->getLocale()->currency('EUR')->toCurrency($price);

Solution 4:

By this code for formating price in product list

echo Mage::helper('core')->currency($_product->getPrice());