I am trying to understand the product images and more specifically the images under the more view section.
I can see in teh /template/catalog/product/view/media.phtml file the loop at the bottom that goes through all the images for the product.
The problem is that it is putting every image in the more view section. I have 3 images uploaded; a base, a small and a thumbnail.
The section of code is:
Code:
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" rel="ja-colorbox" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"> <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
1. What is the ‘image’ and ‘thumbnail’ doing in this code?
2. What do I need to do in order to only show the base images in the more view section?
Thanks
Janice
2 answers
Hi Janice!
Please give me your login information FTP and admin account to your site via your support ticket IDO-658-58710 in http://support.joomlart.com. Also give me the link to product. I’ll check and give the correct direction soon. Thanks.
Hi Janice!
Thanks for sharing the login information FTP/Admin account to your site. This code:
Code:
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" rel="ja-colorbox" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"></a>
Will give you a link to image file (source link) and the other:
Code:
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" />
Will create a thumbnail for that image.
To only show main image in more view section please replace this code:
Code:
<?php foreach ($this->getGalleryImages() as $_image): ?> <li> <a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" rel="ja-colorbox" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"> <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a> </li> <?php endforeach; ?>
by this code:
Code:
<li> <?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?> <?php $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(50,50).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />'; echo '<a title="'.$this->htmlEscape($this->getImageLabel()).'" rel="ja-colorbox" href="'.$this->helper('catalog/image')->init($_product, 'image').'" >'.$_helper->productAttribute($_product, $_img, 'image').'</a>'; ?> <?php else: ?> <?php $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(50).'" alt="'.$this->htmlEscape($_product->getImageLabel()).'" />'; echo $_helper->productAttribute($_product, $_img, 'image') ?> <?php endif; ?> </li>
Please tell me if you need more helps. Thank you.