1

I try to overload sales/order/items/renderer/default.phtml to modify order printing format

In my layout.xml I defined :

<sales_order_view>
    <reference name="my.account.wrapper">
        <block type="sales/order_view" name="sales.order.view">
            <block type="sales/order_items" name="order_items" template="sales/order/items.phtml">
                <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>mymodule/sales/order/items/renderer/default.phtml</template></action>
                <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>mymodule/sales/order/items/renderer/default.phtml</template></action>
            </block>
        </block>
    </reference>
</sales_order_view>

    <sales_order_print>
        <reference name="content">
            <block type="sales/order_print" name="sales.order.print" template="sales/order/print.phtml">
                <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>mymodule/sales/order/items/renderer/default.phtml</template></action>
                <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>mymodule/sales/order/items/renderer/default.phtml</template></action>
            </block>
        </reference>
    </sales_order_print>

When I generate the order print view, my new renderer is applied, but the generated page displays the order summary 2 times…

An idea why?

Thank you for your help,

1 Answer 1

2

it works with :

<sales_order_print>
    <reference name="sales.order.print">
        <action method="setTemplate"><value>sales/order/print.phtml</value></action>
        <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>quotemodule/sales/order/items/renderer/default.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>quotemodule/sales/order/items/renderer/default.phtml</template></action>
    </reference>
</sales_order_print>

You have to use <reference> instead of <block>, to apply the methods on the existing block. <block> always creates a new block.

1
  • Feel free to accept your own answer, so that this question does not appear as "unanswered" anymore. Aug 26, 2015 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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