1.首页添加一个文件
[php]
class Mage_Adminhtml_Block_Catalog_Product_Image_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
public function render(Varien_Object $row) {
return $this->_getValue($row);
}
protected function _getValue(Varien_Object $row) {
$_product = Mage::getModel('catalog/product')->load($row->getEntityId());
$val = str_replace("no_selection", "", $_product->getThumbnail());
$url = Mage::getBaseUrl('media') . 'leerimgs/catalog/product' . $val;
if ($_product->getThumbnail())
$out = "<a onclick=\"window.open('".$url."','Image','width=600,height=850,resizable=no');
return false;\" href='javascript:void(0)'><img src=". $url ." width='60px'/></a>";
return $out;
}
}
[/php]
2.修改一处 Mage_Adminhtml_Block_Catalog_Product_Grid
[php]
protected function _prepareColumns() {
$this->addColumn('image', array( 'header' => Mage::helper('catalog')->__('Image'), 'align' => 'left', 'index' => 'thumbnail', 'width' => '70', 'renderer' => 'Mage_Adminhtml_Block_Catalog_Product_Image_Image' )); ...
}
[/php]