1

I want to insert my custom .phtml code in one of the magento core page. To be more specific i want to put my code in order to be displayed in <my-server-name>/index.php/admin/sales_order/view/order_id/1 page. For the sake of example i put the code direct into the /design/adminhtml/default/default/template/sales/view/tab/info.phtml and now the view looks like in the capture.enter image description here

My question is how to achive this task but without touching the core file ?

2

You need to overwrite the adminhtml templates. First add the admin theme in the stores -> admin section of your modules config.xml

<stores>
    <admin>
        <design>
            <theme>
                <template>yourcustomname</template>
            </theme>
        </design>
    </admin>
</stores>

Then copy the original file to app/design/adminhtml/default/yourcustomname/template/sales/view/tab/info.phtml and make your changes.

But I think you missed something in the path, the original template is located in app/design/adminhtml/default/default/template/sales/order/view/tab/info.phtml, therefore the custom template location would be app/design/adminhtml/default/yourcustomname/template/sales/order/view/tab/info.phtml

  • It works. Now, how can i inject some data from my controller in this template ? I want to display some data based on some logic created in my controller file. – Soptareanu Alex Mar 8 at 14:25
  • 1
    I'm not sure what your controller's role is in this issue. Usually in Magento there are blocks which prepare the data for templates. In your case the Magento block is Mage_Adminhtml_Block_Sales_Order_View_Tab_Info. You can overwrite that block and add whatever functionality there. The controller of that page is Mage_Adminhtml_Sales_OrderController you may overwrite that too, depending on what you need to do and add functionality there. Depending on what you want to do you can also create a helper and simply get access it's methods from everywhere with Mage::helper('yourhelpername') – HelgeB Mar 8 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.