2012-04-14 10 views
1

$ this-> getGalleryImages()の助けを借りてmedia.phtml(Cloud Zoom拡張機能付き)が製品ページのすべての画像をリストしている様子を確認できます。Magento:製品ページのすべての画像を表示する(view.phtml)

<?php foreach ($this->getGalleryImages() as $_image): ?> 
<?php ... ?> 
<?php endforeach; ?> 

しかし、私はカタログ製品ページテンプレートですview.phtmlでの$ this - > getGalleryImages()を使用する場合、それは返したり、出力は何もしません。しかし、これは唯一の製品ページ上の最初の画像を印刷します:私は(、media.phtmlないview.phtml)を反復処理し、製品ページ上のすべての製品の画像を表示することができますどのように

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->setWatermarkImageOpacity(0)->resize(300, null);?>" alt="<?php echo $this->htmlEscape($this->getImageLabel());?>" title="<?php echo $this->htmlEscape($this->getImageLabel());?>" /> 

私の質問はありますか?基本的には、サムネイルやズームなど何もせずに、ページ上に表示することができます。

ありがとうございます!ここで

答えて

11

は、商品画像のギャラリーを示すためのコード..です

おかげで、 JEET

<?php $_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages(); ?> 
<?php if($_images){?>    
    <?php $i=0; foreach($_images as $_image){ $i++; ?> 
     <img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(108,90); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel());?>" title="<?php $this->htmlEscape($_image->getLabel());?>" /><?php } ?> 
    <?php } ?> 
関連する問題