15

In the transactional email code, I see this:

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

Which, I believe, refers to this template file:

/app/design/adminhtml/default/default/template/email/order/items.phtml

I've tried creating a new folder with our theme to avoid overwriting core files:

/app/design/our_theme/default/default/template/email/order/items.phtml

But this doesn't seem to work, is there a proper way to override this file without simply overwriting the core?

20

Actually it refers to a Layout XML handle you can find in the sales.xml file around line 268.

There you can find the following tags

<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>

You can copy this to your own themes local.xml and edit whatever you need. In your case it would be resetting the template file like so:-

<sales_email_order_items>
    <reference name="items">
        <action method="setTemplate">
            <template>yourdirectory/order/items.phtml</template>
        </action>
    </reference>
</sales_email_order_items>
  • Oops, you are totally right. Thank you! Will accept when possible :) – waffl Sep 3 '13 at 10:38
  • No problem, it can be somewhat confusing :) – Sander Mangel Sep 3 '13 at 10:47
  • @SanderMangel How can I create {{layout handle="sales_email_order_items" order=$order}} other than default, which I will be using in the email templates(Other than order confirmation email template) – Mukesh Feb 19 '14 at 9:51
  • I'm not sure what you mean but you can call any handle from the local.xml from your email template. So you can create a new one if you want – Sander Mangel Feb 19 '14 at 9:58
6

You can see which template "sales_email_order_items" refers when looking into

app/design/frontend/base/default/layout/sales.xml
app/design/frontend/base/default/layout/bundle.xml
app/design/frontend/base/default/layout/downloadable.xml

In app/design/frontend/base/default/layout/sales.xml for example you will see:

<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>

Here you can find out the path: template="email/order/items.phtml"

Your directory structure /app/design/our_theme/default/default/template/email/order/items.phtml seems wrong, especially the part /app/design/our_theme/default/default/template... - it should be /app/design/our_theme/default/template... (one default less, i guess).

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.