2

I'm trying to override the Mage_Adminhtml_Block_Sales_Order_Grid class, but no success with that.

My config.xml file:

<?xml version="1.0"?>
<config>
    <modules>
        <AD_Tweaks>
            <version>1.0.0</version>
        </AD_Tweaks>
    </modules>
    <global>
        <models>
            <catalog>
                <rewrite>
                    <product>AD_Tweaks_Catalog_Model_Product</product>
                </rewrite>
             </catalog>
         </models>
         <blocks>
             <catalog>
                 <rewrite>
                     <layer_filter_attribute>AD_Tweaks_Catalog_Block_Layer_Filter_Attribute</layer_filter_attribute>
                     <layer_filter_price>AD_Tweaks_Catalog_Block_Layer_Filter_Price</layer_filter_price>
                </rewrite>
            </catalog>
            <adminhtml>
                <rewrite>
                    <sales_order_grid>AD_Tweaks_Adminhtml_Block_Sales_Order_Grid</sales_order_grid>
                    <sales_order_create_form_account>AD_Tweaks_Adminhtml_Block_Sales_Order_Create_Form_Account</sales_order_create_form_account>
                </rewrite>
            </adminhtml>
         </blocks>
     </global>
</config>

My overriding PHP File located on /app/code/local/AD/Tweaks/Adminhtml/Block/Sales/Order/Grid.php:

    <?php
    class AD_Tweaks_Adminhtml_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
    {
        public function __construct()
        {
            // ***This function should be executed, but it fails***
            Mage::log('Class ' . get_class($this) . ' is being created');
            parent::__construct();
        }
}

I tried even to put a Mage::log('1111'); statement on top of the overriding class (before the class operator), but it probably doesn't loads my PHP file because there is no 1111 shown in logs.

The error is displayed in the browser is:

Fatal error: Call to a member function setSaveParametersInSession() on a non-object in /var/www/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php on line 66

2 Answers 2

3

You Rewrite grid file location is wrong

/app/code/local/AD/Tweaks/Adminhtml/Block/Sales/Order/Grid.php

should be

/app/code/local/AD/Tweaks/Block/Adminhtml/Sales/Order/Grid.php

Also need to chnage in classs

AD_Tweaks_Block_Adminhtml_Block_Sales_Order_Grid

Also

<sales_order_grid>AD_Tweaks_Adminhtml_Block_Sales_Order_Grid</sales_order_grid>

change

<sales_order_grid>AD_Tweaks_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
2
  • 1
    Are you sure it should be AD_Tweaks_Block_Adminhtml_Block_Sales_Order_Grid with double Block word? Commented Sep 7, 2014 at 18:01
  • Anyway, it doesn't work. Also are sure that Adminhtml and Block should be swapped? Notice that I'm trying to override Mage_Adminhtml_Block_Sales_Order_Grid — so look to the placement of these words. Commented Sep 7, 2014 at 18:03
1

Well, I solved the problem just by changing the files permissions to www-data instead of root.

2
  • I am also facing same problem not abel to override Mage_Adminhtml_Block_Permissions_User_Grid Commented Sep 11, 2014 at 9:51
  • @AnishaShaikh, have you tried to do this by placing to the config.xml file <global><blocks><adminhtml><rewrite><permissions_user_grid>Your_Module_Block_Permissions_User_Grid</permissions_user_grid></rewrite></adminhtml></blocks></global> Commented Sep 11, 2014 at 13:05

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.