我爲每個產品上傳2張圖像。只有2個不多,不少。
Product Images http://i43.tinypic.com/2py6zpu.png 1st image is product base image and will be displayed on product details page。Magento在詳細信息頁面上顯示多個產品圖像
我使用下面的行顯示這些圖像:
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(180, 300).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
我能夠正確地顯示上述圖像。
單擊某個鏈接時,彈出顯示第二個圖像。我不想展示畫廊。只想分別顯示每個圖像。
我想我找到了一種方法來檢索上傳的圖片的排列:
$productData = $_product->getData();
$secondImage = $productData['media_gallery']['images'][1];
現在,我不知道如何顯示此圖像。我的意思是如何使用幫手,就像我用第一張圖片製作的那樣是顯示第二張圖片。 我已經選擇硬編碼圖像和使用的完整路徑:
$secondImage['file'];
顯示圖像等,但是,我想知道是否有辦法,我能做到Magento的方式嗎?
我正在處理您的解決方案。我想我會有一些骯髒的伎倆,使其工作:)。並且爲了記錄,您不能在** view.phtml **頁面上使用'$ this-> getGalleryImages()',或者執行'$ images = $ this-> getGalleryImages(); $ image2 = $ images [1];'因爲,這裏的數組索引是圖像ID ... – Ravish
謝謝@ b00mer,我解決了我的問題。我使用'
Ravish
無法在1.9中顯示任何圖像 –