Step 1
======================================
Create Directories (if NOT there)
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/
Step 2
======================================
Create a file named “Image.php” at the following location
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/
Step 3
======================================
Paste the following code into “Image.php” created above
}
======================================
Create Directories (if NOT there)
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/
Step 2
======================================
Create a file named “Image.php” at the following location
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/
Step 3
======================================
Paste the following code into “Image.php” created above
class <Mycomapname>_<Mymodule>_Block_Adminhtml_Grid_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
if($row->getData($this->getColumn()->getIndex())==""){
return "";
}
else{
$html = '<img ';
$html .= 'id="' . $this->getColumn()->getId() . '" ';
$html .= 'width="45" ';
$html .= 'height="35" ';
$html .= 'src="' . Mage::getBaseUrl("media") . $row->getData($this->getColumn()->getIndex()) . '"';
$html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
return $html;
}
}
You do not need to overwrite any thing at all, just follow these simple steps instead Step 1 ====================================== Create Directories (if NOT there) app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/ app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/ Step 2 ====================================== Create a file named “Image.php” at the following location app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/ Step 3 ====================================== Paste the following code into “Image.php” created above
class <Mycomapname>_<Mymodule>_Block_Adminhtml_Grid_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract Step 4 ====================================== Open app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/<Mymodule>/Grid.php and paste the following code into the function protected function _prepareColumns() some where
$this->addColumn('<Tbl_Colname>', array(
===================================================================
|
No comments:
Post a Comment