2014-11-24 51 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

您不能在電子郵件模板中使用邏輯運算符。相反,您可以做的是使用自定義方法擴展銷售訂單模型,該方法返回一個適用於您的布爾值,然後在沒有邏輯運算符的情況下調用該布爾值。