2017-02-16 49 views
0

我工作的Magento 1.9.2.4 这个存在于我的grid.phtml代码显示在主页上相同的产品图片列表

<div class="box-images"> 
 
       <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"> 
 
        <img <?php if(isset($layzyload)): ?>class="owl-lazy"<?php endif; ?> <?php if(isset($layzyload)): ?>data-src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($widthImage, $heightImage); ?>"<?php else: ?>src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($widthImage, $heightImage); ?>"<?php endif; ?> alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /> 
 
       </a> 
 
        <?php if($_product->isSaleable()): ?> 
 
         <div class="quickview"><a class="view-detail" <?php if(Mage::getStoreConfig('quickview/general/enabled')):?> id='fancybox<?php echo $_product->getId()?>' href="<?php echo $this->getUrl('quickview/index/ajax',array('product_id'=>$_product->getId())); ?>"<?php else: ?> href="<?php echo $_product->getProductUrl() ?>" href="<?php echo $_product->getProductUrl() ?>" <?php endif ?> title="<?php echo $this->__('Quick View') ?>"><i class="fa fa-search"></i></a></div>

如何改变它显示该产品中存在的所有图像

+0

可能重复的[Magento:在list.phtml中获取图像库](http://stackoverflow.com/questions/3756103/magento-get -image-gallery-in-list-phtml) – dudzio

回答

0
<?php $_gallery = $product->getMediaGalleryImages(); ?> 
<?php foreach($_gallery as $_item): ?> 
    <?php $_resized_image_url = $this->helper('catalog/image')->init($_product, 'image', $_item->getFile())->resize($widthImage, $heightImage); ?> 
<?php endforeach; ?> 
+0

不,这段代码不起作用 –

相关问题