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

Linking image attribute
 
jordandoor4
Jr. Member
 
Total Posts:  3
Joined:  2013-04-10
 

Hey guys,

I have a quick question regarding, the creation of an image attribute.

I have created an attribute to pull in a dropdown list, the dropdown list contains several images. The idea is the client can select an item from the list within the product and this will display on the product page.

I have added the following code to the catalog.xml - <action method="addAttribute"><name>product_fabric_swatches</name></action>
And am not too sure what code I need to add to the view.phtml -

Any help or possible code reword would be appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dinker
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2010-09-17
India
 

Hi

Magento doesn\’t allows image attribute to appear as dropdown. If you have added a dropdown attribute \’product_fabric_swatches\’ with few options then how will you link the images to options?

the code you have written in catalog.xml is useless.

Please try to explain the exact issue with some possible screenshots or URL, I will definitely sort out your problem.

Thanks
Dinker

 
Magento Community Magento Community
Magento Community
Magento Community
 
jordandoor4
Jr. Member
 
Total Posts:  3
Joined:  2013-04-10
 

Hi, Thanks for you reply.

I have managed to get the dropdown attribute to do what I needed with the help of an ex-colleague (Magento Guru).

I basically needed a dropdown attribute with several items in the list which are then linked to a relevant image. In this case a simple image of “wood swatches, fabric swatches etc.

How did you conclude the code written in the catalog.xml is useless? That initial code combined with the code below added in the view.phtml did the trick.

<img src="/media/swatches/<?php echo str_replace(" ","-",strtolower($_product->getAttributeText('product_fabric_swatches'))); ?>.jpg” alt="<?php echo $_product->getAttributeText('product_fabric_swatches') ?>” />

Regards

Jp

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