Search code examples
phpmagentomoduleenterprise

Magento Overwrite in Adminhtml failing


So I've tried everything I can think of tfor this order info page and exhausting every search I can think of, so now I need to ask. I'm trying to rewrite the admin>sales order>view order page. I have created the module to overwrite what I thought was the area but it's getting all funky.

config.xml for the module

<config>
<modules>
    <Mage_Salespage>
        <version>0.1.0</version>
    </Mage_Salespage>
</modules>

<global>

    <blocks>

        <adminhtml>
            <rewrite>
                <sales_order_view>Mage_Salespage_Block_Sales_Order_View_Info</sales_order_view>
            </rewrite>
        </adminhtml>

    </blocks>

    <helpers>
        <mage_salespage>
            <class>Mage_Salespage_Helper</class>
        </mage_salespage>
    </helpers>
    <models>
        <mage_salespage>
            <class>Mage_Salespage_Model</class>
        </mage_salespage>
    </models>

</global>

The Info.php for the module

class Mage_Salespage_Block_Sales_Order_View_Info extends Mage_Adminhtml_Block_Sales_Order_View_Info
{
    protected function _construct()
    {
    $this->setTemplate('salespage/sales/order/view/info.phtml');
    }     
}

Issue shown at https://i.sstatic.net/QQ2dZ.png since I don't have enough rep yet What am I doing wrong?


Solution

  • Fluffs McKenzie, There are issue in block type code at config.xml.

    You want to rewrite class Mage_Adminhtml_Block_Sales_Order_View_Info

    As per as magento it block type is

    adminhtml/sales_order_view_info but you was rewrite class admihtml/sales_order_view .

    when a block type adminhtml/sales_order_view_info then it class emulate by this process:

    • adminhtml -> Mage_Adminhtml_Block
    • sales_order_view_info -> Sales_Order_View_Info

    then final class is Mage_Adminhtml_Block_Sales_Order_View_Info

    So you need change at

    from

    <sales_order_view>Mage_Salespage_Block_Sales_Order_View_Info</sales_order_view>
    

    To

    <sales_order_view_info>Mage_Salespage_Block_Sales_Order_View_Info</sales_order_view_info>