Home » Magento

Magento: Format Price

23 November 2009 5,364 views Popularity: 10% Share/Bookmark

When you fetch product data, you get the price as integer. Now, you must display the price with currency suffix. You can do this with the following code:-

// let $_finalPrice be the integer price fetched

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

From Mukesh Chapagain's Blog, post Magento: Format Price

Related posts:

  1. Magento: How to get actual price and special price of a product?
  2. Magento: Convert Price from Current Currency to Base Currency and vice-versa
  3. Magento: Create Catalog Price Rule Programmatically
  4. Magento: Create Shopping Cart Price Rule Programmatically
  5. Magento: Setup multiple currency shop
  6. Magento: How to get Currency Rates?
  7. Magento: How to change Currency symbol by Model Override ?
  8. Magento: How to change Currency symbol ?
  9. PHP: Simple and easy way to format URL string
  10. Magento: Show Currency Selector in right sidebar
  • Pingback: Tweets that mention Magento: Format Price | Mukesh Chapagain's Blog -- Topsy.com

  • Niyi

    Hello

    This is a bit close to what I have been looking for. I called the prices for my products to the homepage using getFinalPrice() ?>. The Problem I am having is that a product that appears to be $1,000 on its product pages appeared as 1000.0000. I have tried all my little ideas of magento but still cannot get past this. The currency symbol is missing too.
    How can I resolve this jam? Any help will be appreciated please.
    Thanks

  • http://twitter.com/pharmokan Joseph Jerenstein

    awesome! thanks!

  • http://blog.chapagain.com.np/ Mukesh

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

    This should give you the price with currency symbol in front. If it is not so then try like this:-

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

  • http://blog.chapagain.com.np/ Mukesh

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

    This should give you the price with currency symbol in front. If it is not so then try like this:-

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

  • Jaishliani

    Hi,

    How to include our new Indian currency symbol in magento.?

  • Magento12

    Thanks

  • Veandro

    Thank you!

  • Vijay kumar Mahgato

    Thanks you ….

  • Bonvcihikachoun

    which file that i should add these codes?

  • Oscar

    At what part of the file do I place this code?