Magento

eCommerce Software for Online Growth

Magento Forum

From setting up your store to managing your products, pages and promotions to generating detailed reports, the Magento User Guide empowers the user to utilize the platform for all of its vast capacity.
Available in eBook and Print formats – Download Now!!!
   
How to Use New Image Attributes? 
 
SlamMan
Jr. Member
 
Total Posts:  19
Joined:  2008-08-14
 

I’m trying to wrap my head around how to use the image attributes.  I’m no developer so please bare with me.

Here’s an example of what we would like to do.  If we had a store selling herbal supplements we would need an image on the product page showing the product ingredient label.  We wouldn’t just want that image to show up among the other product images but separately next to the product description. 

When I add a new image attribute to the attribute set I’m using it shows up as a column with radio buttons in the image tab of the product management page.  Can we create a new image attribute, name it Product Label (product_label), and place that tag so that is shows the image with that radio button selected in that spot?

Am I over simplifying it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Raptor Commerce (Matt)
Member
 
Total Posts:  49
Joined:  2009-08-10
 

It’s actually quite simple. We did something similar for a client in which we displayed a brand logo on the product pages. In short we created a new ‘block’ which looked for the logo attribute (as set in the admin console) and displayed it on the product detail page. The block looked something like this:

class Mage_Catalog_Block_Product_View_Logo extends Mage_Core_Block_Template
{
    
protected $_product null;
    protected 
$_logo null;
    
    public function 
getLogo() {
        
if (!$this->_logo{
            $this
->_logo $this->getProduct()->getLogo();
        
}
        
return $this->_logo;
    
}
    
    
function getProduct() {
        
if (!$this->_product{
            $this
->_product Mage::registry('product');
        
}
        
return $this->_product;
    
}    

}

We also needed a template file which called the getLogo() method on the Block class:

<img src="<?php $this->getLogo(); ?>" />

Finally we needed to modify the catalog.xml to include the new block we had created on the product details page

<block type="catalog/product_view_logo" name="logo" as="logo" template="catalog/product/view/logo.phtml" />

I’ve simplified it all a bit but that’s the general idea ... create a block and template then modify the layout file to include the new block. Of course if you’re not a programmer this will all seem like chinese to you! But maybe you can find a developer who can help you

Matt

 Signature 

Raptor Commerce
Creators of the Supermenu extension for Magento

 
Magento Community Magento Community
Magento Community
Magento Community
 
SlamMan
Jr. Member
 
Total Posts:  19
Joined:  2008-08-14
 

Thanks for the feedback, Matt.  That is a bit Chinese to me but I think I get the idea.  In this situation did you have a logo image uploaded and specified on each product management page or does it insert the logo based on the selected manufacture attribute? 

I assume we could set it up so it would reference the newly added “custom” image attribute we were able to add the attribute set?

 
Magento Community Magento Community
Magento Community
Magento Community
 
SlamMan
Jr. Member
 
Total Posts:  19
Joined:  2008-08-14
 

Any other help on this?  I’d be interested in hiring someone to help us implement this on our site.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
© Copyright 2010 Magento Inc.
Privacy Policy|Terms of Service
Magento Community Count
277247 users|1206 users currently online|347000 forum posts