1

I have a custom module, whose content I need to show on Order Details page.

Not under any new tab or something but just above the "Order Totals" div.

How do I accomplish this without modifying any core files?

2 Answers 2

1

Add layout file in yourmagento/app/design/adminhtml/default/default/layout/yourmodule.xml

Add below content in that:

  <adminhtml_sales_order_view>
    <reference name="order_tab_info">
        <action method="setTemplate">
            <template>yourmodule/sales/order/view/tab/info.phtml</template>
        </action> 
<!-- Add your block to display in above order total block -->
    </reference>
</adminhtml_sales_order_view>

Copy default info.phtml file from app/design/adminhtml/default/default/template/sales/order/view/tab/info.phtml to app/design/adminhtml/default/default/template/yourmodule/sales/order/view/tab/info.phtml

Add your content in info.phtml as per your need above order total div.

4
  • "<!-- Add your block to display in above order total block -->" I am sorry to ask but in what way I should add the block?
    – Helly
    Commented Jan 20, 2014 at 10:33
  • here you can add block which you wanted to display above order total, eg.: <block type="adminhtml/sales_order_view_history" name="order_history" template="sales/order/view/history.phtml"></block> above block is added to show order history using <?php echo $this->getChildHtml('order_history') ?> in info.phtml I hope you can understand what i am trying to say :) Commented Jan 20, 2014 at 10:36
  • Yes followed you but getting this error: Invalid method Mage_Adminhtml_Block_Sales_Order_View_Tab_Info::shouldDisplayCustomerIp(Array ( ) )
    – Helly
    Commented Jan 20, 2014 at 10:50
  • have you extend your custom block with Mage_Adminhtml_Block_Sales_Order_View_Info class? Commented Jan 20, 2014 at 10:54
6

To add the contents to the Order Information section (First block on the admin order page), inside app/design/adminhtml/default/default/layout/yourmodule.xml add below:

<adminhtml_sales_order_view>
    <reference name="order_info">
        <action method="setTemplate">
            <template>yourmodule/sales/order/view/info.phtml</template>
        </action> 
    </reference>
</adminhtml_sales_order_view>

Now you can copy:

app/design/adminhtml/default/default/template/sales/order/view/info.phtml

to

app/design/adminhtml/default/default/template/yourmodule/sales/order/view/info.phtml

Now you can add your stuff to the info.phtml inside your module, without change the core files.

1
  • 1
    The problem on this approach is conflicting with other modules that already override this file. Commented Jan 7, 2015 at 13:39

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.