create folder on given module path path
code\local\Package\Module\Block\Adminhtml\Module\Renderer
then create file in given folder Image.php
and put the code as suggested.
<?php
class Package_Module_Block_Adminhtml_Module_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract{
public function render(Varien_Object $row)
{
$html = '<img width="75" height="75" ';
$html .= 'id="' . $this->getColumn()->getId() . '" ';
$html .= 'src="' . Mage::getBaseUrl('media').$row->getData($this->getColumn()->getIndex()) . '"';
$html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
// $html .= '<br/><p>'.$row->getData($this->getColumn()->getIndex()).'</p>';
return $html;
}
}
?>
save file
then go to grid file path is given bellow
app\code\local\Package\Module\Block\Adminhtml\Module\Grid.php
and add new column in following ways
$this->addColumn('image', array(
'header' => Mage::helper('module')->__('image'),
'align' =>'left',
'index' =>'image',
'renderer' =>'module/adminhtml_module_renderer_image'
));
No comments:
Post a Comment