Add New Image Attribute in Magento backend and Get all images of that new image attribute

3.7k views Asked by At

I have added the new image attribute in magento admin by creating new attribute using catalog=>attributes=>manage attribute and new attribute is showing in admin.

but problem is that how I can get all images of this attribute.?enter image description here

I added the Pos image attribute .Now I want all images of this attribute using coding.Please help

1

There are 1 answers

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

you can get image using this code change your label to get different image if thumbnail then use thumbnail