【问题标题】:Magento: get price in current currencyMagento:以当前货币获取价格
【发布时间】:2015-09-09 11:28:31
【问题描述】:

我有一个扩展程序,可以在标签页中显示主页上的产品。它使用以下代码来获取产品的价格

$price = $_product->getPrice();

然后使用下面的代码来显示它

echo '<span class="price">'.number_format($price,2).'</span>'

它在基础货币上工作,但选择另一种货币时,它不会将价格转换为该货币。

如何改为以当前货币显示价格?

【问题讨论】:

    标签: magento


    【解决方案1】:

    试试这个

    $price = number_format($price,2);
    
    $formatedPrice = Mage::helper('core')->currency($price, true, false);
    
    echo '<span class="price">'.$formatedPrice.'</span>'
    

    【讨论】:

      猜你喜欢
      • 2020-09-29
      • 1970-01-01
      • 2011-10-07
      • 2015-06-08
      • 1970-01-01
      • 2021-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多