2014-11-24 74 views
1

我需要为贝宝付款发送同样的电子邮件模板,用于“等待付款”和“取消”,但是当我通知客户他们有一个待付款它应该说Your order is in pending payment。如果我在管理员中点击取消按钮,电子邮件内容应为unfortunately your order has been cancelled在Magento的同一个电子邮件模板中添加一个条件来修改电子邮件内容

我在邮件模板尝试这样做:

{{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. 订单状态有时会返回取消,有时它返回取消。我不确定它为什么不一致!

回答

0

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