Magento 1.9: How to Change Admin .PHTML Files

admin-panelmagento-1.9

In the order table if create a custom field, now i want that field in the "Sales/order/info" how can i do this? And is it possible to do this without creating a module?
I'm using magento 1.9

Best Answer

Without a module might be tricky. You will need a layout XML file and a template file.

You can find the code below as a module on my Bitbucket page

the layout XML

<adminhtml_sales_order_view>
   <reference name="order_info">
      <action method="setTemplate"><template>mymodule/sales/order/view/info.phtml</template></action>
      <block type="adminhtml/sales_order_view_info" name="original_order_info" template="sales/order/view/info.phtml"></block>
   </reference>
</adminhtml_sales_order_view>

And in the template file we'll call the old info.phtml and add any info you want extra above or below that. app/design/adminhtml/default/default/template/mymodule/sales/order/view/info.phtml

<?php
/**
 * here you can do whatever you want
 */
?>
<?php echo $this->getChildHtml('original_order_info');?>

Extending the _afterHtml method or using an observer means using code to fix a layout method. IMO not the best way to go about it.

Related Topic