0

This question already has an answer here:

I have created custom module in magento. Its working good. But now my problem is, I want to add product grid to my product list tab.I have found the solution through this link.I have created new tab.But when i load that tab, its shows me an error like

Fatal error: Call to a member function setProdlist() on a non-object in /home/trendyc/public_html/app/code/community/Whole/Cate/controllers/Adminhtml/WhcatalogController.php on line 64

Mycontroller file's productsAction code here

$this->getLayout()->getBlock('products.grid')
            ->setProdlist($this->getRequest()->getPost('products_prodlist', null));

I think, i need to do some modification on layout file. But i can't get what modifications need to do there in layout .xml file.I hope you understand my problem. Please help me guys!

marked as duplicate by Marius, Keyul Shah, David Manners, user487772 Jan 21 '14 at 18:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

The error message indicates that the function is called on a non-object. Looking at your code, the object which seems to be a "non-object" is $this->getLayout()->getBlock('products.grid'). This indicates that your block is not declared correctly in the layout. You should have a layout update for adminhtml where you have something like

<adminhtml_whcatalog_index>
    <reference name="content">
       <block name="products.grid" type="YOUR/GRIDTYPE" />
    </reference>
</adminhtml_whcatalog_index>

Not the answer you're looking for? Browse other questions tagged or ask your own question.