zoukankan      html  css  js  c++  java
  • magento解决分类页没有产品图片报Image file was not found

    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.'));
            }
        }
  • 相关阅读:
    Java-集合类汇总
    Java-ArrayList
    Java-ArrayList和Vector的区别
    Java-List
    Java-Stack
    Java-Vector
    Java-HashMap
    Java-EnumSet
    18校招借鉴
    spring的设计模式
  • 原文地址:https://www.cnblogs.com/you-jia/p/4546385.html
Copyright © 2011-2022 走看看