Monday, June 6, 2011

how to get the currency code for current store in magento?

// Currency Code for Bangladesh is "BDT"
Mage::app()->getStore()->getCurrentCurrencyCode();

Source : http://harisur.net/how-to-get-the-currency-code-for-current-store-in-magento

how to get the currency symbol for current store in magento?

// Currency Symbol for Bangladesh is "Tk"
Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();

Source : http://harisur.net/how-to-get-the-currency-symbol-for-current-store-in-magento

how to define the product price with default currency format in mageto?

normally $_product->getPrice() method return the product price in basic number format with 4 digits after decimal point, it’s look like 123.4567.
But the default currency format of magento is $123.46. see, default currency format done round with 2 digits after decimal point. and another important thing is, it’s put the currency code before the price.
lets see how to do that…
echo $_product->getPrice();
// will display : 123.4567
echo Mage::helper('core')->currency($_product->getPrice());
// will display : BDT123.46 [BDT, currency code of Bangladesh]

Source : http://harisur.net/how-to-define-the-product-price-with-default-currency-format-in-mageto