Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

New Image Attributes
 
mattSpoon
Jr. Member
 
Total Posts:  1
Joined:  2008-01-22
 

I made a new Attribute with the type as Image. My goal is to put in an additional image on the products page that has a model photo (clothing) but that isn’t the main photo. When I would go edit my products to upload the model photo, the photos wouldn’t upload. It would say success but there would still be nothing in the admin section, the media folder where the other images were uploaded and there wasn’t a database item for it. I figured out that in the eav_attribute table of the database, the entry for my new Attribute was blank in the backend_model and frontend_model columns. If I copy over the values from the other image entries “catalog_entity/product_attribute_backend_image” images would upload fine. Great.

Now my question is getting it to display. In my view.phtml template file, i changed the getImageUrl() to getModelImageUrl() (just for testing, to make sure I can call to the image) and created a new method:

public function getModelImageUrl()
    
{
        $url 
false;
        if (!
$this->getModelImage()) {
            $url 
Mage::getDesign()->getSkinUrl('images/no_image.jpg');
        
}
        
elseif ($attribute $this->getResource()->getAttribute('model_photo')) {
            $url 
$attribute->getFrontend()->getUrl($this);
        
}
        
return $url;
    
}
in app/code/core/Mage/Catalog/Model/Product.php. That works great only its showing the “no_image.jpg”. I think it has to do with the getModelImage() part. I tried globally searching for getImage() and getSmallImage() which the other methods are using but I cannot seem to find them.

Could someone show me where they are located or explain how the images are being generated. I’ve worked all day on this and I feel I’m really close, but caught on a snag.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sherrie
Moderator
 
Avatar
Total Posts:  1655
Joined:  2007-12-14
Waterloo, ON
 

I know this is in the great depths of the archives, but ... did you ever figure this out?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top