在列表产品magento上获得颜色

时间:2013-02-20 12:19:05

标签: php magento

我需要一些帮助来开始开发脚本以获取Magento中列表产品的颜色标签。我不想在点击时切换图片,我只是想表明该特定产品有超过1种颜色。

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

<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 }?>

1 个答案:

答案 0 :(得分:0)

问题中的剧本工作得很完美,而不是爆炸它的正确位置。