返回NULL我们已经扩展主页滑块的客户,使他们能够拥有的产品在这个领域。getGalleryImages在Magento主页
作为其中的一部分,还有,我们希望得到的产品的主图像三个图像插槽,然后两个图像从媒体库(理想随机但如果在世界末日的ID)。
为了得到更好的理解,请看一下我们至今截图: -
我们使用以下建设集此模块: -
$featured_products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*')
->AddAttributeToFilter('featured', array('eq' => 1));
获取产品的主要形象是没有问题的,这是完美的与以下内容: -
<img class="gallery" src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(225); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($product, 'small_image'), null, true) ?>" />
而且这是很简单的让所有三个图像插槽使用主图像,如下图所示以上。
当我们试图但是调用getGalleryImages,这总是返回NULL
(例如如): -
<?php if (count($this->getGalleryImages()) > 0): ?>
<?php foreach ($this->getGalleryImages() as $_image): ?>
<img class="gallery" src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(100); ?>" width="100" height="100" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" />
<?php endforeach; ?>
<?php endif; ?>
请可以在最好的办法有人提醒打电话主页上的画廊图像。有什么我们可以包括到集合构建,否则我们将需要添加一个观察者。
在此先感谢。
这还出现了返回'NULL'。如有必要,我可以提供更多使用的代码。谢谢。 – zigojacko