Home » Magento

Magento: Format Price

23 November 2009 4,603 views Popularity: 10% Share/Bookmark

email

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);

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. jQuery: Grey out background and preview image as popup
  6. jQuery: Print array and object
  7. PHP: Simple and easy way to format URL string
  8. Magento jQuery: How to use them together?
  9. Magento: Payment method not displayed in Multiple Shipping Adresses Checkout
  10. Magento: Get all shopping cart items and totals
  • http://topsy.com/trackback?utm_source=pingback&utm_campaign=L2&url=http://blog.chapagain.com.np/magento-format-price/ Tweets that mention Magento: Format Price | Mukesh Chapagain’s Blog — Topsy.com

    [...] This post was mentioned on Twitter by Mukesh Chapagain, Joonkiri J. Joonkiri J said: Format price in #Magento http://bit.ly/agHMlw .. just one line of code and you are done ;) [...]

  • 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?