Home » Magento28 March 2011

Magento: Fatal error: Call to a member function setSaveParametersInSession() on a non-object

Scenario

I was creating a module. I already had one Grid displayed in admin. The Grid was being displayed by a Block class, for example: MyNamespace_MyModule_Block_Adminhtml_MyModule
Now, I had to display another Grid using a new Block class. Let’s say, I created a new Block class: MyNamespace_MyModule_Block_Adminhtml_MyNewGrid

I just copied code from MyNamespace_MyModule_Block_Adminhtml_MyModule and copied it to MyNamespace_MyModule_Block_Adminhtml_MyNewGrid class.

MyNamespace_MyModule_Block_Adminhtml_MyModule

MyNamespace_MyModule_Block_Adminhtml_MyNewGrid

Cause

The main mistake over here was the confusing naming for controller and blockGroup.

$this->_controller = This is not the controller class name. It is actually your Block class name.
$this->_blockGroup = This is your module’s name.

Solution

Hence, I updated my new grid class in the following way and the problem was solved. See the change in controller and blockGroup from the previous code.

MyNamespace_MyModule_Block_Adminhtml_MyNewGrid

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed