Skip to main content
Commonmark migration
Source Link

We need config.xml file of your module in order to properly help you out. However we can give some hints based on the controller file that you have provided.

##Why Error Happends ?

Why Error Happends ?

The error is producing by this line which you can see in Foo_Bar_Adminhtml_BazController::gridAction()

$this->getLayout()->createBlock('Foo/adminhtml_Foo_grid')->toHtml()

Here createBlock() function is used to create a new block in your layout. Reference to the block that you want to create is wrong and hence you are getting this error.

##Story Behind Error

Story Behind Error

In general createBlock() has following structure:

 createBlock('block_group_name/path_to_your_file')
  • block_group_name stands for block unique reference in your module. In this case, you specified it as Foo. This is defining inside config.xml.

  • In the general context Magento will look for block a class Namespace_Module_Block_Path_To_Your_File in app\code\{local|community}\Namespace\Module\Block\Path\To\Your\File.php (Here I assume block_group_name is defined by the module Namespace_Module). So it is very important to have the class name and file path follows same concept in your case.

##What You Should Check

What You Should Check

So possible errors are :

  1. Your block group name reference may be wrong. ie Foo is wrong.
  2. Your block file path should be app\code\community\Foo\Bar\Block\Adminhtml\Foo\Grid.php
  3. Class name should be Foo_Bar_Block_Adminhtml_Foo_Grid.

After recheck all these points, please make sure you cleared all cache.

EDIT

I can see your config.xml file now. Based on this, the right code in your controller would be

$this->getLayout()->createBlock('foo_bar/adminhtml_foo_grid')->toHtml()

We need config.xml file of your module in order to properly help you out. However we can give some hints based on the controller file that you have provided.

##Why Error Happends ?

The error is producing by this line which you can see in Foo_Bar_Adminhtml_BazController::gridAction()

$this->getLayout()->createBlock('Foo/adminhtml_Foo_grid')->toHtml()

Here createBlock() function is used to create a new block in your layout. Reference to the block that you want to create is wrong and hence you are getting this error.

##Story Behind Error

In general createBlock() has following structure:

 createBlock('block_group_name/path_to_your_file')
  • block_group_name stands for block unique reference in your module. In this case, you specified it as Foo. This is defining inside config.xml.

  • In the general context Magento will look for block a class Namespace_Module_Block_Path_To_Your_File in app\code\{local|community}\Namespace\Module\Block\Path\To\Your\File.php (Here I assume block_group_name is defined by the module Namespace_Module). So it is very important to have the class name and file path follows same concept in your case.

##What You Should Check

So possible errors are :

  1. Your block group name reference may be wrong. ie Foo is wrong.
  2. Your block file path should be app\code\community\Foo\Bar\Block\Adminhtml\Foo\Grid.php
  3. Class name should be Foo_Bar_Block_Adminhtml_Foo_Grid.

After recheck all these points, please make sure you cleared all cache.

EDIT

I can see your config.xml file now. Based on this, the right code in your controller would be

$this->getLayout()->createBlock('foo_bar/adminhtml_foo_grid')->toHtml()

We need config.xml file of your module in order to properly help you out. However we can give some hints based on the controller file that you have provided.

Why Error Happends ?

The error is producing by this line which you can see in Foo_Bar_Adminhtml_BazController::gridAction()

$this->getLayout()->createBlock('Foo/adminhtml_Foo_grid')->toHtml()

Here createBlock() function is used to create a new block in your layout. Reference to the block that you want to create is wrong and hence you are getting this error.

Story Behind Error

In general createBlock() has following structure:

 createBlock('block_group_name/path_to_your_file')
  • block_group_name stands for block unique reference in your module. In this case, you specified it as Foo. This is defining inside config.xml.

  • In the general context Magento will look for block a class Namespace_Module_Block_Path_To_Your_File in app\code\{local|community}\Namespace\Module\Block\Path\To\Your\File.php (Here I assume block_group_name is defined by the module Namespace_Module). So it is very important to have the class name and file path follows same concept in your case.

What You Should Check

So possible errors are :

  1. Your block group name reference may be wrong. ie Foo is wrong.
  2. Your block file path should be app\code\community\Foo\Bar\Block\Adminhtml\Foo\Grid.php
  3. Class name should be Foo_Bar_Block_Adminhtml_Foo_Grid.

After recheck all these points, please make sure you cleared all cache.

EDIT

I can see your config.xml file now. Based on this, the right code in your controller would be

$this->getLayout()->createBlock('foo_bar/adminhtml_foo_grid')->toHtml()
Source Link
Rajeev K Tomy
  • 17.3k
  • 6
  • 63
  • 103

We need config.xml file of your module in order to properly help you out. However we can give some hints based on the controller file that you have provided.

##Why Error Happends ?

The error is producing by this line which you can see in Foo_Bar_Adminhtml_BazController::gridAction()

$this->getLayout()->createBlock('Foo/adminhtml_Foo_grid')->toHtml()

Here createBlock() function is used to create a new block in your layout. Reference to the block that you want to create is wrong and hence you are getting this error.

##Story Behind Error

In general createBlock() has following structure:

 createBlock('block_group_name/path_to_your_file')
  • block_group_name stands for block unique reference in your module. In this case, you specified it as Foo. This is defining inside config.xml.

  • In the general context Magento will look for block a class Namespace_Module_Block_Path_To_Your_File in app\code\{local|community}\Namespace\Module\Block\Path\To\Your\File.php (Here I assume block_group_name is defined by the module Namespace_Module). So it is very important to have the class name and file path follows same concept in your case.

##What You Should Check

So possible errors are :

  1. Your block group name reference may be wrong. ie Foo is wrong.
  2. Your block file path should be app\code\community\Foo\Bar\Block\Adminhtml\Foo\Grid.php
  3. Class name should be Foo_Bar_Block_Adminhtml_Foo_Grid.

After recheck all these points, please make sure you cleared all cache.

EDIT

I can see your config.xml file now. Based on this, the right code in your controller would be

$this->getLayout()->createBlock('foo_bar/adminhtml_foo_grid')->toHtml()