Monday, June 6, 2011

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

No comments:

Post a Comment