码迷,mamicode.com
首页 > 其他好文 > 详细

magento解决分类页没有产品图片报Image file was not found

时间:2015-06-02 15:04:37      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:

For your Custom module follow following steps 1) you can create folder for placeholder images at

  media/mymodule/placeholder/placeholderImage.jpg

2) re-Write model Class

 Mage_Catalog_Model_Product_Image

3) Update the method

  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.‘));
        }

replace with

$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.‘));
        }
    }

magento解决分类页没有产品图片报Image file was not found

标签:

原文地址:http://www.cnblogs.com/you-jia/p/4546385.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!