1

I'm making some changes on the following file: app/design/frontend/base/default/template/email/order/items/order/default.phtml

and what I need is to check if there's a custom trasactional email template used, and if it is, I'd like to get it's ID. (System > Transactional Emails)

I have no idea how to do this! Could you please help me?

EDIT : SOLUTION (based on Marius suggestions)

In file addp/design/frontend/base/default/layout/sales.xml, after <sales_email_order_items>...</sales_email_order_items> I added the following code

<sales_email_order_items_dupl>
    <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_duplicate.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default_duplicate.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_dupl>

1 Answer 1

2

The template is not aware of the email template that is calling it.
If your template needs to look differently based on the e-mail, you need to use 2 templates for 2 different emails.
I mean instead of using in both of them

 {{layout handle="some_handle_here"}}

in both of them, you need to use in the section one something like this:

 {{layout handle="some_other_handle_here"}}

and create the new layout handle in one of your layout files and use a different template file.

5
  • Right now the template use this handler: {{layout handle="sales_email_order_items" order=$order}}
    – zekia
    Sep 16, 2014 at 8:10
  • But if change handler should I create another .phtml file? Can you give me more information?
    – zekia
    Sep 16, 2014 at 8:11
  • 1
    @ktsixit. If you create a other handle you need to create a new phtml file also. Actually clone the sales_email_order_items into an other layout handle, and inside it change the reference to /email/order/items/order/default.phtml to a new template you create. Again clone the template and do your needed changed.
    – Marius
    Sep 16, 2014 at 8:14
  • please check the question edits. Is that solution correct?
    – zekia
    Sep 16, 2014 at 8:50
  • Seams ok at a first glance. Now you have to use the layout handle in your email template sales_email_order_items_dupl: {{layout handle="sales_email_order_items_dupl" order=$order}}
    – Marius
    Sep 16, 2014 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.