Magento 显示两种货币(获取货币汇率)
我正在尝试做一些相当简单的事情,但事实证明这非常棘手。
我希望我的产品页面以英镑和欧元显示价格(但是他们只能使用商店视图中当前设置的货币进行购买)。
如果我能找到如何获得货币汇率,我可以自己进行计算以显示正确的价格,但到目前为止我还没有运气。这是我尝试过的:
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
$euro = Mage::getModel('directory/currency')->getCurrencyRates('EUR', array_values($allowedCurrencies));
显示“1.00000”,这不是速率(应该是 1.1948)
我已经完成了所需的所有配置,并使用 WebserviceX 导入了速率。
任何帮助将不胜感激。
I'm trying to do something fairly simple, but it's proving quite tricky.
I want my product page to display the price in GBP and EUR (however they can only buy using whichever currency is currently set on the store view).
If I could find out how to get the currency rate, I could make the calcualtions myself to display the correct price, but I've had no luck so far. This is what I've tried:
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
$euro = Mage::getModel('directory/currency')->getCurrencyRates('EUR', array_values($allowedCurrencies));
Displays '1.00000' which isn't the rate (should be 1.1948)
I have done all the configuration required and have imported the rates with WebserviceX.
Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我设法获得了货币汇率,我的代码几乎是正确的:
I managed to get the currency rates, my code was almost correct: