Reputation:
In Magento, does anyone know how to limit the amount of thumbnails to be shown under the main product image?
Is this something that is easily controlled via the admin or should I go into media.phtml and edit the php?
<div class="more-views">
<ul>
<?php foreach ($this->getGalleryImages() as $_image): ?>
<li>
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $_product->getName();?>" onclick="$('image').src = this.href; return false;">
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(103, 103); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
Upvotes: 0
Views: 3291
Reputation: 51
Yes, you can easily control via the admin, which images you want to show under the main product image, but you need to set for all the products individually.
Simply go to images tabs of add/edit product. click on the exclude checkbox which you don't want to show on image gallery and then hit the save button.
Upvotes: 0
Reputation: 17656
The quickest way would be
<div class="more-views">
<ul>
<?php $limit = 5; ?>
<?php $ct = 0; ?>
<?php foreach ($this->getGalleryImages() as $_image): ?>
<li>
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $_product->getName();?>" onclick="$('image').src = this.href; return false;">
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(103, 103); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
</a>
</li>
<?php
if(++$ct >= $limit)
break;
?>
<?php endforeach; ?>
</ul>
</div>
Upvotes: 0