0

I'm a bit stuck with this one. I've uploaded images on our Magento and they do not belong in "image, small_image, thumbnail" labels. They have their own labels in the Media Gallery, which is "Back".

I would like to use this "Back" image as a hover on our product listing page (category page). I've tried using:

<?php echo $_product->getMediaGalleryImages()->getItemByColumnValue('label', 'Back')->getUrl();?>

To get the URL of the image and use

<img> 

to show it. It gives me an error where it only shows one product and it gets messed up.

I've tried this as well, and gives me a different error, where it does show the back of the image when I hover, BUT it only shows one product and that's it (there is usually 1500+ in the category itself)

<?php echo Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages()->getItemByColumnValue('label','Back')->getUrl(); ?>

I'm not well versed in PHP as much as I should be, so maybe the code is wrong?

Lilly
  • 11
  • 1
  • 4
  • Possible duplicate: http://stackoverflow.com/a/7448017/763468 – Steve Robbins Jul 08 '13 at 17:01
  • Looked at that before and unfortunately that post did not help me :( – Lilly Jul 08 '13 at 17:19
  • What is your error? Post more of your categories code. – Simon H Jul 10 '13 at 19:56
  • Sorry - pretty late reply. No complete answer really.. but here is what I did. I eventually just had to create a media gallery attribute and just linked it from there. I basically had to back track because I now I bunch of missing images but.. I couldn't find a way to link it and just gave up. :( – Lilly Jul 18 '13 at 17:30
  • oops, couldn't edit my last post beyond 5 mins. *continued If anyone has this same issue, another option would just to create a media gallery attribute and link it with : 'helper('adaptiveResize/image')->init($_product, 'hover_image')->adaptiveResize(225, 285); ?>' – Lilly Jul 18 '13 at 17:37

0 Answers0