Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento: get price in current currency

Tags:

magento

I am having an extension that shows the products on main page in tabs. It uses the following code to get the price of product

$price = $_product->getPrice();

and then uses the following code to display it

echo '<span class="price">'.number_format($price,2).'</span>'

It works OK on the base currency but when another currency is selected it will not convert the price to that currency.

How can I show the price in current currency instead?

like image 780
dmSherazi Avatar asked Nov 19 '25 05:11

dmSherazi


1 Answers

Try this

$price = number_format($price,2);

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

echo '<span class="price">'.$formatedPrice.'</span>'
like image 107
Mukesh Avatar answered Nov 22 '25 04:11

Mukesh