【发布时间】:2014-02-18 21:36:42
【问题描述】:
你好,
我的 Magento 商店有一些奇怪的问题:
我们在 /index.php/checkout/cart/ 和 index.php/checkout/onepage/ 上收到 500 错误(空白页)
通过查看@错误日志,我们得到以下信息:
ERR (3): Recoverable Error: Argument 1 passed to Mage_Catalog_Helper_Image::init() must be an instance of Mage_Catalog_Model_Product, null given, called in /home/headsh78/public_html/app/design/frontend/default/eon/template/catalog/product/featured.phtml on line 90 and defined in /home/headsh78/public_html/app/code/core/Mage/Catalog/Helper/Image.php on line 139
和
ERR (3): Recoverable Error: Argument 1 passed to Mage_Catalog_Helper_Image::init() must be an instance of Mage_Catalog_Model_Product, null given, called in /home/***/public_html/app/design/frontend/default/eon/template/catalog/product/bestseller.phtml on line 82 and defined in /home/***/public_html/app/code/core/Mage/Catalog/Helper/Image.php on line 139
对应的代码如下:
<?php $product = Mage::getModel('catalog/product')->load($_product->getId());
foreach ($product->getMediaGalleryImages() as $image) {
//echo var_export($image); ?>
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $image->getFile())->resize(71, 65); ?>" width="71" height="65" alt=""/>
<?php } ?>
和
public function init(Mage_Catalog_Model_Product $product, $attributeName, $imageFile=null)
有人愿意帮助我们吗?
【问题讨论】: