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

时间:2014-11-24 16:11:52

标签: php email 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. 我的如果条件似乎没有效果。任何想法为什么不呢?
  2. 订单状态有时会返回已取消,有时会返回已取消。我不确定为什么它不一致!

1 个答案:

答案 0 :(得分:0)

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

相关问题