Magento – Problem in creating new block in Admin order page

adminhtmlblocksmagento-1magento-1.7

I am trying to create a new block in my admin panel "Sales->Order->View" Information tab.

In my extension's block folder i have a folder named Adminhtml in this i have file named : Company.php

class Namespace_Modulename_Block_Adminhtml_Company extends Mage_Adminhtml_Block_Sales_Order_Abstract
{
}

In my extension module i have placed this code in config.xml under etc folder

 <adminhtml>
    <layout>
        <updates>
            <modulename>
                <file>module.xml</file>
            </modulename>
        </updates>
    </layout>
</adminhtml>

then i have my adminhtml layout file as :

<?xml version="1.0"?>
  <layout version="0.1.0">
   <modulename_adminhtml_company_index>
    <reference name="order_info">
        <block type="modulename/adminhtml_company" name="modulename" template="company.phtml" />
    </reference>
   </modulename_adminhtml_company_index>
  </layout>

But nothing happened yet,

Thanks in advance,

Best Answer

Go to template/sales/order/view/info.phtml and add:

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

in the place where you want your block to be displayed. The point here is that only blocks of type core/text_list (or derivates) will list all their child blocks html. The other blocks need to ouput them using getChildHtml

Related Topic