Remember that grid is working fine.Here module is consider as Bd_Collegeprogram
First add the code in the _prepareColumns() function
$this->addColumn("image", array(
"header" => Mage::helper("collegeprogram")->__("Image"),
"index" => "image",
'type' => 'image',
'width' => '50px',
'renderer' => 'collegeprogram/adminhtml_collegeprogram_renderer_image'
));
Now create a block as adminhtml_collegeprogram_renderer_image
class Bd_Collegeprogram_Block_Adminhtml_collegeprogram_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{
public function render(Varien_Object $row)
{
$html = '<img ';
$html .= 'id="' . $this->getColumn()->getId() . '" ';
$html .= 'src="' . $row->getData($this->getColumn()->getIndex()) . '"';
$html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
return $html;
}
}
First add the code in the _prepareColumns() function
$this->addColumn("image", array(
"header" => Mage::helper("collegeprogram")->__("Image"),
"index" => "image",
'type' => 'image',
'width' => '50px',
'renderer' => 'collegeprogram/adminhtml_collegeprogram_renderer_image'
));
Now create a block as adminhtml_collegeprogram_renderer_image
class Bd_Collegeprogram_Block_Adminhtml_collegeprogram_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{
public function render(Varien_Object $row)
{
$html = '<img ';
$html .= 'id="' . $this->getColumn()->getId() . '" ';
$html .= 'src="' . $row->getData($this->getColumn()->getIndex()) . '"';
$html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
return $html;
}
}
It is alos required to overried in module adminhtml/catalog_product_grid to apply columns enhacements and columns content appear. Also it easier to Admin Product Grid Images with more flexibility.
ReplyDelete