Format price in the current locale and currency

前端 未结 7 1111
感情败类
感情败类 2021-01-30 03:32

I use :

$product->getPrice();

to get the unformatted price that I can calculate \"quantity X price\" with ajax.

I want to reformat

相关标签:
7条回答
  • 2021-01-30 03:37

    I think Google could have answered your question ;-) See http://blog.chapagain.com.np/magento-format-price/.

    You can do it with

    $formattedPrice = Mage::helper('core')->currency($finalPrice, true, false);
    
    0 讨论(0)
  • 2021-01-30 03:41

    For formatting the price in another currency than the current one:

    Mage::app()->getLocale()->currency('EUR')->toCurrency($price);
    
    0 讨论(0)
  • 2021-01-30 03:41

    try this:

    <?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?>
    
    0 讨论(0)
  • 2021-01-30 03:49

    By this code for formating price in product list

    echo Mage::helper('core')->currency($_product->getPrice());
    
    0 讨论(0)
  • 2021-01-30 03:50

    This is a charming answer. Work well on any currency which is selected for store.

    $formattedPrice = Mage::helper('core')->currency($finalPrice, true, false);
    
    0 讨论(0)
  • 2021-01-30 03:51

    Unformatted and formatted:

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

    Or use:

    Mage::helper('core')->formatPrice($price, true);
    
    0 讨论(0)
提交回复
热议问题