开发者

How to get product image label outside the gallery?

i'm looking for a way to get image label without having to fetch the whole product mediaGallery. By default, here is how Magento does it :

<?php foreach ($this->getGalleryImages() as $_image): ?>
    <li>
        <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
    </li>
<?php endforeach;开发者_StackOverflow社区 ?>

And what I want to do is something that :

$_product->someimageattribute->getLabel()


Here's an example from catalog/product/list.phtml.

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜