为您的magento自定义模块按照以下步骤1)为图像占位符,您可以创建文件夹 media/mymodule/placeholder/placeholderImage.jpg 2) 重写 model Class Mage_Catalog_Model_Product_Image 3) 更新方法 public function setBaseFile($file) Line around at 304 $baseFile = $baseDir . $file; if ((!$file) || (!file_exists($baseFile))) { throw new Exception(Mage::helper('catalog')->__('Image file was not found.')); } 替换为 $baseFile = $baseDir . $file; if ((!$file) || (!file_exists($baseFile))) { $module = $this->getRequest()->getModuleName(); if($module=='mymodule'){ $baseFile = Mage::getBaseUrl('media').'mymodule/placeholder/placeholderImage.jpg'; }else{ throw new Exception(Mage::helper('catalog')->__('Image file was not found.')); } }(责任编辑:好模板) |