如何在 magento 购物车中显示两种货币



我想在Magento的购物车和发票中显示两种货币。我已经通过此代码在产品页面中制作了它

<div class="currency">
<?php if( Mage::app()->getStore()->getCurrentCurrencyCode() == 'USD'): ?>
<span class="price">(<?php echo round(Mage::helper('directory')->currencyConvert( $_product->getFinalPrice(), 'USD', 'AUD'), 2 ); ?>) AUD</span>
<?php else: ?>
<span class="price">(<?php echo round(Mage::helper('di`enter code here`rectory')->currencyConvert( $_product->getFinalPrice(), 'AUD', 'USD'), 2 ); ?>) USD</span>
<?php endif; ?>
</div> 

现在我想在电子邮件发票中显示它。

在电子邮件模板 ti 中有这一行

{{layout handle="sales_email_order_items" order=$order}}
查找销售布局

,我们发现应用程序\设计\前端[包][主题]\布局\销售.xml

从那里您可以看到用于呈现电子邮件项目部分的 .phtml 文件,编辑您需要的文件,请记住,这些文件也用于前端。

如果要分隔 .phtml 文件,以便前端和电子邮件模板可以使用不同的文件,请在.xml文件中复制/粘贴/重命名sales_email_order_items并将template=部分更改为新模板,请确保在电子邮件模板中将上述句柄更改为将布局重命名为的句柄,否则它将使用原始句柄。

您的代码应该可以正常工作,您可能只需要更改$_product->getFinalPrice()如果它不起作用,并且 $_product 可能不在模板中或是一个不同的类,因为您处理的是处理sales_flat_order而不是catalog_product

最新更新