How to add custom block after items block into order view page in magento

In order view page, add a custom block after any type of block. Here I show you, how you can create a block after items block. You can visit my previous post overwrite sales order view. So lets start.

Suppose namespace is “Exercise” and module name is “CustomSales”

Step 1 : Create a module config file into app/etc/modules/Exercise_CustomSales.xml


Step 2: Create a config file under app/code/local/Exercise/CustomSales/etc/config.xml


Step 3: Create a block app/code/local/Exercise/CustomSales/Block/Sales/Order/View/Custom.php

class Exercise_CustomSales_Block_Sales_Order_View_Custom extends Mage_Core_Block_Template

Step 4: Create a layout config file app/design/adminhtml/default/default/layout/exercise_customsales.xml

<layout version="0.1.0">
        <reference name="order_items">
            <action method="setTemplate"><template>customsales/sales/order/view/items.phtml</template></action>
            <block type="customsales/sales_order_view_custom" name="customsales_sales_order_view_custom" template="customsales/sales/order/view/custom.phtml"/>

Step 4: Copy sales/order/view/items.phtml into customsales/sales/order/view/items.phtml
Open this file and add one line code, look like,

<div class="grid np">
<br />
<?php echo $this->getChildHtml('customsales_sales_order_view_custom');?>

Step 5: Create a new file customsales/sales/order/view/custom.phtml, you can add your custom content. Clear cache and go to order view page.

Enjoy magento code!

2 thoughts on “How to add custom block after items block into order view page in magento

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.