I hid some of the images using the class names - My modification:
$start_image = VmConfig::get('add_img_main', 1) ? 0 : 1;
for ($i = $start_image; $i < count($this->product->images); $i++) {
$image = $this->product->images[$i];
if ((strstr($image->file_class, "class-1")!==False) || (strstr($image->file_class, "class-2")!==False)) {
echo $image->displayMediaThumb("",true,"rel='vm-additional-images'",true,$image->file_description);
}}
My problem - variable $i shows 100% of images (with hidden ones). How to do it so that the variable $i shows the actual number of display images?
If you can hide images as your code sais. Simply create a new var $iv that counts the visible images. Simply put in your loop.
Regards
Jörgen @ Kreativ Fotografi
OMG. I'm stupid - it's simple :)
Quote$real = 0;
$start_image = VmConfig::get('add_img_main', 1) ? 0 : 1;
for ($i = $start_image; $i < count($this->product->images); $i++) {
$image = $this->product->images[$i];
if ((strstr($image->file_class, "class-1")!==False) || (strstr($image->file_class, "class-2")!==False)) {
$real++
echo $image->displayMediaThumb("",true,"rel='vm-additional-images'",true,$image->file_description);
}}
echo $real;
Nice that You got it solved
Jörgen @ Kreativ Fotografi
Id dont know if this is the core code but
$i < count($this->product->images)
is bad because he count on each iteration
$totalimage = count($this->product->images);
for ($i = $start_image; $i < $totalimage; $i++) {
is a better code
And you dont need to count in the loop
YOu can do
$real = $totalimage-$start_image;
The complet code is then
$start_image = VmConfig::get('add_img_main', 1) ? 0 : 1;
$totalimage = count($this->product->images);
$real = $totalimage-$start_image;
for ($i = $start_image; $i < $totalimage; $i++) {
$image = $this->product->images[$i];
if ((strstr($image->file_class, "class-1")!==False) || (strstr($image->file_class, "class-2")!==False)) {
echo $image->displayMediaThumb("",true,"rel='vm-additional-images'",true,$image->file_description);
}}
echo $real;