Magento 1.9 – Include Bank Details in Email Template for Bank Transfer Payment

email-templatesmagento-1.9payment-methods

In my store there are two payment methods enabled. One of these is the "Bank Transfer". I would like to be able to add the bank details in the "New order email template" only when the customer has choosen the "Bank Transfer" payment method.

Is there a way to check this information inside the template with something like

{{if payment == 'banktransfer'}}
 Bank Details
....
....
{{endif}}

or is there a way to use multiple template based on the payment method specified by the customer?

Best Answer

I managed to do it by including a block into the template. In the middle of my template I inserted this:

{{block type='core/template' area='frontend' template='email/order/bankdetails.phtml' order=$order store=$store}}

insid the bankdetails.phtml file I perform this check to decide whether to include bank details or not:

<?php $_order = $this->getOrder(); ?>
<?php if(!is_null($_order) && $_order->getPayment()->getMethodInstance()->getCode() == 'banktransfer') : ?>

....
bank details
....

<?php endif; ?>
Related Topic