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

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

This error occurs due to invalid grid path in the block constructor

example :

public function __construct(){
$this->_controller = ‘adminhtml_advertisement’; /**this sould be the path of the admin html files*/
$this->_blockGroup = ‘test_advertisement’; /** this should be proper path**/
parent::__construct();
$this->_headerText = Mage::helper(‘test_advertisement’)->__(‘Advretisement’);
$this->_updateButton(‘add’, ‘label’, Mage::helper(‘test_advertisement’)->__(‘Add Advretisement’));

}

Please dont be confused about $this->_controller this is not controller name this is the path of the grid which will generate Adminhtml_Advertisement_Grid

$this->_blockGroup is block namespce which you specify in config.xml file.
Note : : If the block groups and controller points the correct path to the grid (Grid.php) file there will occur no error so make sure the both of them produces the correct class name of the Grid.php

$this->_controller = ‘adminhtml_advertisement’;
$this->_blockGroup = ‘test_advertisement’;
should produce the following class name :

Test_Advertisement_Block_Adminhtml_Advertisement_Grid

example :

       <blocks>
            <test_advertisement>
                <class>Test_Advertisement_Block</class>
            </test_advertisement>
        </blocks>

Advertisements

Add Comment

📖 Read More