Magento购物车和结帐页面出现错误500
你好, 我对我们的Magento商店有一些奇怪的问题: 我们的/index.php/checkout/cart/和index.php/checkout/onepage上出现了500个错误(空白页)/ 通过查看@error log,我们得到以下信息:Magento购物车和结帐页面出现错误500,magento,php,Magento,Php,你好, 我对我们的Magento商店有一些奇怪的问题: 我们的/index.php/checkout/cart/和index.php/checkout/onepage上出现了500个错误(空白页)/ 通过查看@error log,我们得到以下信息: ERR (3): Recoverable Error: Argument 1 passed to Mage_Catalog_Helper_Image::init() must be an instance of Mage_Catalog_Model_
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
及
相应代码如下:
<?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 } ?>
有人愿意帮助我们吗?
您的代码似乎有点不干净。您指的是同一产品,但在某些情况下,您称为$product或$\u product或$this->getProduct() 对于您的特定问题,请尝试将
$this->getProduct()
替换为$product
,并尝试一下
<?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)