如何在Magento中向上销售时获得基本图像

如何在Magento中向上销售时获得基本图像,magento,Magento,我想显示在向上销售的基础图像,而不是缩略图或小图像,但图像 我在upsell.phtml中尝试了以下代码 <?php echo $this->helper('catalog/image')->init($_link, 'image')->resize(118,82) ?> 但它不起作用 有什么想法吗 非常感谢。问题在于,您的产品集合没有每个产品的所有属性,但它有一个子集,其中不包括“图像”属性 解决这一问题的捷径是: $product = Mage::getM

我想显示在向上销售的基础图像,而不是缩略图或小图像,但图像

我在upsell.phtml中尝试了以下代码

<?php echo $this->helper('catalog/image')->init($_link, 'image')->resize(118,82) ?>

但它不起作用

有什么想法吗


非常感谢。

问题在于,您的产品集合没有每个产品的所有属性,但它有一个子集,其中不包括“图像”属性

解决这一问题的捷径是:

$product = Mage::getModel('catalog/product')->load($productId); 
echo '<img src=' . $this->helper('catalog/image')->init($product, 'image')->resize(118, 82) . ' width=\'118\' height=\'82\'/>';

我希望有帮助

它将返回占位符图像路径,不工作。您是否已使用加载($链接->getId())加载产品?如果产品有一个图像集,并且您已经按照显示的方式加载了它,那么它应该可以工作。已经为upsell加载了collection,那么为什么它需要按load函数重新加载?请解释一下。如果没有上述代码,这是可能的?带解释的编辑答案
 $this->_itemCollection->addAttributeToSelect('image');