0

我需要少量帮助才能开始开发脚本以获取 Magento 中列表产品的颜色标签。我不想在点击时切换图片,我只是想表明该特定产品有不止一种颜色可供选择。

好的,我得到了最终的脚本,但我无法得到下面图片的结果

<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
    <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(155); ?>" width="155" height="155" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
</a>

获取列表中相关图像的脚本。

<?php $_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages();?> 
<?php if($_images){?> 
<?php     $i=0; foreach($_images as $_image){ $i++;?> 
<a href="#"> 
    <img src="<?=$this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(200, 130); ?>” width="200" height="130" alt="<?=$this->htmlEscape($_image->getLabel());?>" title="<?=$this->htmlEscape($_image->getLabel());?>" /> 
</a>
<?php     }?>
<?php }?>
4

1 回答 1

0

问题中的脚本运行良好,只是不是爆炸它的正确位置。

于 2013-02-28T13:55:03.340 回答