How to add a block inside order sales view in magento

3.4k views Asked by At

Sales Order View in Admin panel

enter image description here

This is the layout.xml

<layout>
<adminhtml_sales_order_view>
    <reference name="order_tab_info">
        <block type="booking/sales_order_view_reservationbooking" name="reservationbooking" template="booking/sales/order/view/reservationbooking.phtml" />
    </reference>
</adminhtml_sales_order_view>

This is the block in my module

<?php

    class Actino_Booking_Block_Adminhtml_Sales_Order_View_Reservationbooking extends Mage_Core_Block_Template {

    }

Here is my explanation about what i want to achieve

In core adminhtml i edited the sales/order/view/info.phtml.. I know that Never edit the core files, but this is only for test for which i want to display my template around the orders view. and then if this works I should have to create or rewrite the info.phtml.

here is my custom reservationbooking.phtml

enter image description here

and in info.phtml i write a code to view this layout

<?php echo $this->getChildHtml('reservationbooking');?>

This is not working. I cant see the text "reservation booking data" in sales order view. without modifying any core files ? My question is how to add custom field in sales order view ?

1

There are 1 answers

3
Supravat Mondal On

Once a try

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

Create a file in the following app/design/adminhtml/default/default/template/yourmodule/sales/order/view/reservationbooking.phtml

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