Magento 商店视图 - 显示不正确的货币
我已经为我们的 Magento 商店检查并设置了额外的商店视图。此视图的目的是允许显示不同的货币(目前),未来计划允许基于商店视图的语言、内容等。
一切看起来都很正常。当我访问 www.example.com/au 时,我得到了该网站的标准版本,货币为 AU。
当我导航到 www.example.com/us 时 - 正在进行正确的货币转换,以美元显示,但仅在迷你购物车和结帐中显示。类别和产品视图页面仍显示 $AU 值。
这些模板文件是由不同的开发人员完成的,因此我假设他们使用了错误的函数来获取每个项目的价格。他们使用:
<?php echo number_format($_product->getPrice(), 2) ?>
我想我需要投入适当的函数来根据商店视图 ID 获取价格,但我很难追踪到这一点。
当然,一如既往,非常感谢任何帮助。
更新:
我最终使用了这个,它按照我想要的方式工作:
$this->getPriceHtml($_product, true)
I've gone through and set up an additional store view for our Magento store. The purpose of this view is to allow the display of different currency (for now) with future plans to allow language, content, etc based on store view.
Everything seems pretty normal. When I go to www.example.com/au - I get the standard version of the site with $AU as the currency.
When I navigate to www.example.com/us - The proper currency conversion is happening, showing in $US, but only in the mini-cart and checkout. The category and product view pages are still displaying the $AU value.
Those template files were completed by a different developer, and so I'm assuming they used the wrong function to grab the price of each item. They used:
<?php echo number_format($_product->getPrice(), 2) ?>
I'm thinking I need to toss in the proper function that grabs the price based on store view id, but I'm having difficulty tracking this down.
Any help, of course, and as always, much appreciated.
Update:
I ended up using this, and it works how I wanted:
$this->getPriceHtml($_product, true)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这已经很旧了,但我在寻找同一问题的答案时遇到了这个。
您可以使用:
Mage::helper('core')->currency($_product->getPrice())
这会格式化价格(删除尾随零)并转换为正确的货币。如果用户更改其货币也适用。
I know this is old but I came across this while looking for an answer the same question.
You can use:
Mage::helper('core')->currency($_product->getPrice())
This formats the price (removes trailing zeros) and converts to the correct currency. Also works if the user changes their currency.
尝试
根据当前商店货币规则格式化价格(有关详细信息,请参阅
Mage_Directory_Model_Currency::format()
)。Try
it will format price according current store currency rules (see
Mage_Directory_Model_Currency::format()
for more info).