cancel
Showing results for 
Search instead for 
Did you mean: 

Transactional email - Print different texts depending on Payment Method

Transactional email - Print different texts depending on Payment Method

Hello guys, I've been struggling quite a bit trying to understand how variables work in Magento and transactional emails.

 

I need to print a different text according to what the client's payment method. Example: If the payment method is Credit Card I want to print Text A, if the payment method is Debit Card, I want to print Text B, etc...

 

I would really appreciate some help to sove this issue. Should I do that on the transactional email template itself in admin? Or should I do it in code? Where exactly does Magento takes this Payment info to print in the email? 

 

Thank you so much for your help and time!

2 REPLIES 2

Re: Transactional email - Print different texts depending on Payment Method

I would also like to know how to do this.  We are a company that are engaging with a third party developer to set up our ecommerce site, and they have told us that it can't be done - you can only have one set of text on all invoices regardless of the payment option or stock being sold.

Re: Transactional email - Print different texts depending on Payment Method

Hi @MargaroJonas,

 

I'm looking for a really old module I've made but I cant' find the code.

Email templates works, basically as the other blocks on Magento. Take a look to the "New order" template. You'll find (inside the template) a line like whits:

 

{{layout handle="sales_email_order_items" order=$order}}

Now, check this file: app/design/frontend/base/default/layout/sales.xml and then this section:

 

    <sales_email_order_items>
        <block type="sales/order_email_items" name="items" template="email/order/items.phtml">
            <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
            <block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
                <action method="setLabelProperties"><value>colspan="3" align="right" style="padding:3px 9px"</value></action>
                <action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
                <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
                    <action method="setIsPlaneMode"><value>1</value></action>
                </block>
            </block>
        </block>
        <block type="core/text_list" name="additional.product.info" />
    </sales_email_order_items>

Those are the blocks and phtml that will be rendered on your template. You can add your own block to your layout definition and use your block to handle some Order attribute to return one value or another.

Sorry, I can't find that old module but basically, that's the idea.