Magento2:格式化货币价格


提取产品数据时,价格为整数。现在,您必须显示带有货币后缀的价格。
您可以使用以下代码格式化价格。
$ _finalPrice为获取的整数价格。

用货币符号显示价格:

//转换后带货币符号
$formattedPrice = Mage::helper('core')->currency($_finalPrice,true,false);
//转换后不带货币符号
$formattedPrice = Mage::helper('core')->currency($_finalPrice,false,false);

// OR
 
$formattedPrice = Mage::helper('core')->formatPrice($_finalPrice, false);

要显示没有货币符号的价格:

Mage::getModel('directory/currency')->formatTxt($_finalPrice, array('display' => Zend_Currency::NO_SYMBOL));

相关文章

0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论