3

I am stuck in custom code. Actually I want to add custom information section on sales order view page in admin like Account Information', 'Billing Address', 'Shipping Address'. But I don't want to edit any core file like phtml, xml etc.

Here I am attaching screen-shot for more clear to me.

enter image description here

Please help me to get resolve this issue.

Thanks in advance!

3

This article provides a step by step guide of how to add new block in sales orde view page: http://www.webspeaks.in/2015/12/magento-add-custom-block-in-admin-sales-order-page.html

3

By default there are only a 2 options, to add it via plain xml.

before the content, and after the content.

<adminhtml_sales_order_view>
    <reference name="content">
        <block type="core/template" name="test-1" template="test/template.phtml" after="sales_order_edit"/>
        <block type="core/template" name="test-2" template="test/template.phtml" before="sales_order_edit"/>
    </reference>
</adminhtml_sales_order_view>    

but those templates will be shown in all tabs.

to insert into several parts, you have to add your template like:

<adminhtml_sales_order_view>
    <reference name="order_tab_info">
        <block type="core/template" name="test-1" template="test/template.phtml" after="sales_order_edit"/>
        <block type="core/template" name="test-2" template="test/template.phtml" before="sales_order_edit"/>
    </reference>
</adminhtml_sales_order_view>    

Watch out for the changed reference name.

In the corresponding template app\design\adminhtml\default\default\template\sales\order\view\tab\info.phtml you can place your block everywhere you want

[...]
<div id="order-messages">
    <?php echo $this->getChildHtml('order_messages') ?>
</div>
<?php echo $this->getChildHtml('order_info') ?>
<?php echo $this->getChildHtml('test-1') ?>
[...]

the main problem is, that the sales_order_view is kinda hard coded, so it'll keep the structure.

hope that helps.

1

techguy4web, you can follow the below link. It will resolve your requirement. http://sohelrana09.wordpress.com/2011/06/24/how-to-overwrite-sales-view-order-phtml-file-in-magento/

  • thanks Supravat! it's a good solution but not that I am seeking for. I want to set my custom block similar like using setChidBlock in xml directly. – Lalit Kaushik Jun 23 '14 at 8:24

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.