I have another question for you guys 😛
On the product grid view i want to change the image when you hover over it with your mouse.
The image i want to switch it too should have a labelname of ‘back’.
I almost have it..:P
When i use this code in media.phtml:
<?php $imageByLabel = $_product->getMediaGalleryImages()->getItemByColumnValue('label', 'back');?>
<?php echo $this->helper('catalog/image')->init($_product, 'image', $label->getFile())->resize(235, 350);?>
It returns something like this: http://www.mywebsite.com/product/images/image1
When i use this in the source attribute of my image it displays the correct image.
But when i use this code in the catalog/product/list.phtml i get the following error:
Fatal error: Call to a member function getItemByColumnValue() on a non-object in C:\Development\FabriqMagento\app\design\frontend\default\fabriq\template\catalog\product\list.phtml on line 95
PS: line 95 is the following line:
<?php $imageByLabel = $_product->getMediaGalleryImages()->getItemByColumnValue('label', 'back');?>
Any help is appreciated:)
If you review your code,
$imageByLabelis not doing anything so it is not needed.Try:
from
list.phtml