VirtueMart Forum

VirtueMart 2 + 3 => Templating & Layouts => Topic started by: bobthebob01 on February 02, 2012, 09:18:26 am

Title: Remove the first/main image
Post by: bobthebob01 on February 02, 2012, 09:18:26 am
Hi,

first: well done to the VM team for this release. It becomes much better and easier to dev/customize the template since VM is using views now. And with the template overrides, it's even better. Or the way it should be one could say.

Second: i have a little problem with the "show additional images" on the product page, even if using the default view.
The following snippet does show the thumbnail of the first image and it is said that it would show all images but the first one as per this post: http://forum.virtuemart.net/index.php?topic=90935.0 (http://forum.virtuemart.net/index.php?topic=90935.0)
or as follow:
Code: [Select]
<?php if(!empty($this->product->images) && count($this->product->images)>1) {
         foreach (
$this->product->images as $image) {
            echo 
$image->displayMediaThumb('class="product-image"',true,'class="modal"'); //'class="modal"'
         
}
}
?>


Does anybody have an idea how i can remove the first/main image from the thumbnails list?

thanks
Title: Re: Remove the first/main image
Post by: Gruz on February 09, 2012, 13:14:37 pm

Quick answer is:
Code: [Select]
<?php if(!empty($this->product->images) && count($this->product->images)>1) {
         
$first true;
         foreach (
$this->product->images as $image) {
            if (
$first)   {
                  
$first false;
                  continue;
            }
            echo 
$image->displayMediaThumb('class="product-image"',true,'class="modal"'); //'class="modal"'
         
}
}
?>


Full answer is here:
Code: [Select]
http://forum.virtuemart.net/index.php?topic=97365.msg322269#msg322269