0

I generated a module using this online tool: http://www.silksoftware.com/magento-module-creator/

I am now facing this error:

PHP Fatal error: Uncaught Error: Call to a member function setSaveParametersInSession() on boolean in app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php:66

But I don't know how I could debug it. Website is running on Magento CC 1.9.3. Saw this setSaveParametersInSession() on a non-object and that Fatal error: Call to a member function setSaveParametersInSession() on a non-object in aBlock\Widget\Grid\Container.php on line 66 but don't see what I could change.

A dump in core's Container.php, on $this->_blockGroup.'/'.$this->_controller.'_grid' returns me this: 'destinataires/adminhtml_destinataireschauvinfrance_grid'

Which seems right. Am I wrong?

An extract of my config.xml :

<config>
  <modules>
    <Canalweb_Destinataires>
      <version>0.1.0</version>
    </Canalweb_Destinataires>
  </modules>
  <global>
    […]
    <blocks>
      <destinataires>
        <class>Canalweb_Destinataires_Block</class>
      </destinataires>
    </blocks>
    <models>
      […]
      <destinataires>
        <class>Canalweb_Destinataires_Model</class>
        <resourceModel>destinataires_mysql4</resourceModel>
      </destinataires>
      <destinataires_mysql4>
        <class>Canalweb_Destinataires_Model_Mysql4</class>
        <entities>
          <destinataireschauvinfrance>
            <table>destinataires_chauvin_france</table>
          </destinataireschauvinfrance>  
          <destinataireschauvinpays>
            <table>destinataires_chauvin_pays</table>
          </destinataireschauvinpays>
          […]
        </entities>
      </destinataires_mysql4>
    </models>
    […]
    <admin>
      <routers>
        <destinataires>
          <use>admin</use>
          <args>
            <module>Canalweb_Destinataires</module>
            <frontName>admin_destinataires</frontName>
          </args>
        </destinataires>
      </routers>
    </admin>
    <adminhtml>
      <menu>
        <destinataires module="destinataires">
        <title>Destinataires</title>
        <sort_order>100</sort_order>
        <children>
          <destinataireschauvinfrance module="destinataires">
            <title>Manage Destinataireschauvinfrance</title>
            <sort_order>0</sort_order>
            <action>admin_destinataires/adminhtml_destinataireschauvinfrance</action>
          </destinataireschauvinfrance>
          […]

My Block/Adminhtml/Destinataireschauvinfrance.php :

<?php

class Canalweb_Destinataires_Block_Adminhtml_Destinataireschauvinfrance extends Mage_Adminhtml_Block_Widget_Grid_Container{

    public function __construct()
    {
        $this->_controller = "adminhtml_destinataireschauvinfrance";
        $this->_blockGroup = "destinataires";
        $this->_headerText = Mage::helper("destinataires")->__("Destinataireschauvinfrance Manager");
        $this->_addButtonLabel = Mage::helper("destinataires")->__("Add New Item");
        parent::__construct();
    }

Beginning of my Block/Adminhtml/Destinataireschauvinfrance/Grid.php :

<?php

class Canalweb_Destinataires_Block_Adminhtml_Destinataireschauvinfrance_Grid extends Mage_Adminhtml_Block_Widget_Grid
{

    public function __construct()
    {
        parent::__construct();
        $this->setId("destinataireschauvinfranceGrid");
        $this->setDefaultSort("id");
        $this->setDefaultDir("DESC");
        $this->setSaveParametersInSession(true);
    }

What am I not seeing?

1 Answer 1

1

You state in your config.xml that the admin front name of your module is "admin_destinataires" but then you use "destinataires" as the blockgroup.

Try replacing

$this->_blockGroup = "destinataires";

with

$this->_blockGroup = "admin_destinataires";

==Edit==

The 'Call to a member function setSaveParametersInSession() on boolean' error is caused when the grid container class/block cannot find the grid class/block. So my money is still at that the blockgroup you are using is wrong.

If the above does not solve your problem, try replacing all instances of admin_destinataires with destinataires.

1
  • Yes! Replacing all instances of admin_destinataires was the trick. Thank you very, very much!
    – galenskap
    Commented Oct 25, 2017 at 15:38

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.