What i was trying to do was to display thumbnail of images in listing in admin side in one of the custom modules created by me, at that time i came across this error.

Fatal error: Call to a member function setColumn() on a non-object in D:\Program Files\wamp\www\magento\app\code\core\Mage\Adminhtml\Block\Widget\Grid\Column.php on line 291.

closed as unclear what you're asking by Marius, Keyul Shah, Mufaddal, davidalger, benmarks Jan 31 '14 at 14:29

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Some code samples might help. – Marius Jan 31 '14 at 7:01
  • Then post the solution as an answer and accept it. – Marius Jan 31 '14 at 7:10
  • Even if you solved the problem, clarify your questions and post the solution please. – benmarks Jan 31 '14 at 14:29
  • Sorry for the inconvenience...Answer to this is to check the path to render class in _prepareColumns() function in Grid.php. For exmaple, In my case the path to the render class was wrong. Check the below code: $this->addColumn('img', array( 'header' => 'Image', 'align' => 'left', 'index' => 'img', 'width' => '70', 'renderer' => 'demo/adminhtml_grid_renderer_img' )); Here the renderer attribute holds the path to your render class, review it. IF the path is wrong at that time this type of error is shown. – devJsha Feb 3 '14 at 5:35

Open these file Grid php under app>code >core>Mage>Adminhtml>Block>Catalog >Productand in_prepareCollectionmethod add$collection->addAttributeToSelect('thumbnail');just before$this->setCollection($collection);`

add below code in method _prepareColumns

        'header'=> Mage::helper('catalog')->__('Thumbnail'),
        'width' => '50px',
        'index' => 'thumbnail',
        'frame_callback' => array($this, 'callback_image')

After that add below method somewhere in the same file

public function callback_image($value)
    $width = 70;
    $height = 70;
    return "<img src='".Mage::getBaseUrl('media').'catalog/product'.$value."' width=".$width." height=".$height."/>";

thats all cheers. please override these changes if you know how to do that or else these changes will be wiped out during upgrade.

  • by just adding the correct path for render class in 'renderer' attrbute in $this->addColumn() will solve this issue – devJsha Jan 31 '14 at 9:58
  • 3
    Or, don't hack the core! – benmarks Jan 31 '14 at 14:27

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