添加条件以在Magento中的同一电子邮件模板中修改电子邮件内容



我需要为PayPal付款的"待付款"和"取消"发送相同的电子邮件模板,除了当我通知客户他们有待处理的付款时,它应该说Your order is in pending payment。如果我在管理员中单击取消按钮,电子邮件内容应该unfortunately your order has been cancelled

我已经在我的邮件模板中尝试过这个:

{{if order.getStatusLabel() == 'canceled'}}
 <p>unfortunately your order has been cancelled</p>
{{else}}<p>Your order is in pending payment</p>
{{/if}}

但是,已针对这两种类型的订单状态发送了unfortunately your order has been cancelled

  1. 我的 if 条件似乎不起作用。任何想法为什么不呢?
  2. 订单状态有时返回已取消,有时返回已取消我不确定为什么它不一致!

不能在电子邮件模板中使用逻辑运算符。相反,您可以做的是使用自定义方法扩展销售订单模型,该方法返回适合您的布尔值,然后在没有逻辑运算符的情况下调用该方法。

相关内容

最新更新