I'm working on a simple extension for my store and it needs to override a template file.
The template in question is used to generate each line item in the list of items in an order. To see what I'm talking about, you can go to My Account->My Orders, select an order, and then scroll down to see the table under "Items Ordered." The default template file I'm trying to replace is sales/order/items/renderer/default.phtml.
I have successfully set up the extension to use its own layout.xml file. I can, for example, turn off various blocks on the page. My code for changing the template, however, isn't working. I suspect that my reference name(s) is(are) incorrect, but I don't know for sure.
Here is what I have so far:
<?xml version="1.0"?>
<layout version="0.1.0">
<sales_order_view>
<reference name="my.account.wrapper">
<reference name="sales.order.view">
<reference name="order.items">
<reference name="sales.order.item.renderer.default">
<action method="setTemplate">
<template>groupname_extensionname/sales/order/items/renderer/default.phtml</template>
</action>
</reference>
</reference>
</reference>
</reference>
</sales_order_view>
</layout>
Could anyone provide the corrections I need in my xml (and elsewhere if necessary)? Thanks in advance.
Edit:
Here is my modified version of Ben's XML that worked (he only missed an argument that was easy to add):
<?xml version="1.0"?>
<layout version="0.1.0">
<sales_order_view>
<reference name="order_items">
<action method="addItemRender">
<arg1>default</arg1>
<arg2>sales/order_item_renderer_default</arg2>
<arg3>groupname_extensionname/sales/order/items/renderer/default.phtml</arg3>
</action>
</reference>
</sales_order_view>
</layout>
Edit:
I found you can copy the default xml tags for the arguments, so instead of arg1, arg2, arg3 you can have type, block, template.
<?xml version="1.0"?>
<layout version="0.1.0">
<sales_order_view>
<reference name="order_items">
<action method="addItemRender">
<type>default</type>
<block>sales/order_item_renderer_default</block>
<template>groupname_extensionname/sales/order/items/renderer/default.phtml</template>
</action>
</reference>
</sales_order_view>
</layout>