0

I override my sales order view info but the function not working.

config.xml

<global>
<adminhtml>
<rewrite> 
 <sales_order_view_info>MPS_Delivery_Block_Sales_Order_View_Info</sales_order_view_info>
</rewrite>
</adminhtml>
</global>

info.php

class MPS_Delivery_Block_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_View_Info
{
    public function getMyTest(){

        return "Test";
    }
}

I called in my template in this <?php echo $this->getMyTest();?>

What mistake i made here

2 Answers 2

3

I think you have error in your config.xml

Your xml structure is not correct. You need to add your rewrite code in <block> tag and not in <config> tag.

Try adding below inside your <config> tag.

<blocks>
    <delivery>
    <class>MPS_Delivery_Block</class>
    </delivery>
    <adminhtml>
        <rewrite>
            <sales_order_view_info>MPS_Delivery_Block_Adminhtml_Sales_Order_View_Info</sales_order_view_info>
        </rewrite>
    </adminhtml>
</blocks>

Also the file you have created is in wrong location. Create your Info.php at app\code\YOUR_CODEPOOL\MPS\Delivery\Block\Adminhtml\Sales\Order\View\Info.php

Add your code

<?php
class MPS_Delivery_Block_Adminhtml_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_View_Info
{
    public function getMyTest(){

        return "Test";
    }
}
2
  • OMG Thanks Bro... Can you please tell me How to override Sales order shipement page
    – Magento 2
    Commented Apr 8, 2017 at 16:02
  • Will require more details, please add a new question for your new requirement with description about which block to override. Commented Apr 8, 2017 at 16:14
0

In config.xml you have to add tag <blocks> like:

<global><blocks><adminhtml><rewrite>

And Info.php file should have to under Adminhtml folder like: Block/ Adminhtml /Sales/Order/View/Info.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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