Magento:以当前货币获取价格

标签 magento

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

$price = $_product->getPrice();

然后用下面的代码显示出来

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

It works OK on the base currency but when another currency is selected it will not convert the price to that currency.

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

最佳答案

试试这个

$price = number_format($price,2);

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

echo '<span class="price">'.$formatedPrice.'</span>'

关于Magento:以当前货币获取价格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32478328/

相关文章:

css - 主页上的 Logo 位于与其他页面不同的位置

magento - 如何在 magento 多站点上设置 SSL

jquery - 在 jQuery 中调用 `click()` 是否只触发 jQuery 附加事件?

php - Magento fatal error :未找到类'Varien_Data_Collection_Filesystem'

javascript - Magento 自定义选项上的 JS 警报单击

mysql - Magento SQLSTATE [HY000] : General error: 2006 MySQL

图片上传,转到/media/tmp,但保存产品后不保存在媒体/目录中[Magento]

php - Magento 网站不工作(超时)管理页面正在工作

php - Composer - 如何忽略一些 map 文件?

mysql - Magento SQL 查询