Magento If else statement in transactional emails - surely this is simple? -


please can answer (what thought simple exercise, after spending ages checking forum similar answers unfortunately still no clearer).

basically have our invoice transactional email has code:

<td class="method-info"> <h6>payment method:</h6> <p>payment has been received</p> </td> 

basically under payment method used default {{var payment_html}} replaced 'payment has been received'

however payment after delivery method ('cashondelivery') should not 'payment has been received' customer hasn't paid yet!

so please replace basic style logic below work in email

<td class="method-info"> <h6>payment method:</h6>                     if {{var payment_html}} is 'payment after delivery'   echo  {{var payment_html}}  else    echo 'payment has been received'  endif </td> 

sorry ask such basic question, looking new freelance magento developer!

many thanks

in email template, cannot use logical expression in {{if}} or {{depend}} condition like,

{{if order.getpayment().getmethod()=="cashondelivery"}} payment after delivery {{else}} {{var payment_html}} {{/if}} 

so render 'payment after delivery' text if payment method cashondelivery invoice template, have override sendemail function of mage_sales_model_order_invoice class.

in function can add condition like,

if($order->getpayment()->getmethod()=='cashondelivery'){     $paymentblockhtml = mage::helper('sales')->__('payment after delivery'); } 

code_snippet_screenshot

hope helps!


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -