0

I understand how to display an image based on my selection from backend for hover on the product but i am trying to display 1 by 1 sequencely with a delay
For a starting point i have this code that might help, it will load all the images for this product on the gallery, use this on an item somewhere (list.phtml)

<?php 
    $_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages();
 ?>
<?php 
   if($_images){?>          
  <?php  $i=0; foreach($_images as $_image){ $i++;?>
  <a href="#">
    <img src="<?=$this->helper('catalog/image')->init($_product, 'image', $_image->getFile()); ?>"alt="<?=$this->htmlEscape($_image->getLabel());?>" title="<?=$this->htmlEscape($_image->getLabel());?>" width="222px" height="222px" />
   </a>             
<?php  } ?>
<?php  } ?>  

I am thinking with the help of jQuery to do this but i do not want all the images to load on a category cause this will have waiting time, it should load 1 by 1 once the "slideshow' inside the main image will start.

anyone have some free time to play with this and help?

1

What you want is something like this: https://stackoverflow.com/questions/19104115/hover-starts-a-simple-slideshow

Your request isn't very Magento related, but please don't load the product model in a loop, you're shooting yourself in the foot here.

2
  • Thank you Mayers this is a good starting point (exact what i was looking to study) about loading the product in the loop is also my concern as i do not want to kill the database. Any ideas how to make it better?It should be loaded inside list.phtml so we speak about 36 products X all their images for every page. – spanakorizo Nov 8 '16 at 21:05
  • @spanakorizo Have a look there: magento.stackexchange.com/questions/65218/… That's a better way to do it. But in this situation, I would still display less than 36 (seems a lot for Magento). Maybe display 12, and use infinite scroll, that would be a reliable solution – Mayers Nov 8 '16 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.