I currently have a extension that sets a hover on an image when ever it finds a label that is called 'hover'. I wish to change this to hover an image if there is an image with sort order id which is '2'. But I do not know how to do this. The code is below.
$html = ""; $imgcount = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages()->count(); if ($imgcount>0): $_gallery = Mage::getModel('catalog/product') -> load($_product -> getId()) -> getMediaGalleryImages(); foreach ($_gallery as $_image ): if ($_image->getLabel() == 'hover'): $html = '<span class="hover-image"><img ' . $this->getImgSources($_product, $imgType, $w, $h, $_image -> getFile()) . ' alt="" /></span>'; break; endif; endforeach; endif; return $html;
I was hoping it would be as simple as
if ($_image->getSortOrder() == 2): but that was just flawed thinking. Any ideas?