Showing results for 
Search instead for 
Did you mean: 

Add product image to a product from admin drop down menu

Add product image to a product from admin drop down menu



in order to help my customers I would like to add some image illustrations to my products. I have a few hundred products but they are so alike that I need just a few image illustrations. For that reason I would like to avoid uploading and adding a image illustration to each product. I would instead prefer to upload the image illustrations 1 time and then select an image on each product. I've tried to split it up in the following steps:


1. Create a product drop down attribute that contains three values:


2. image_1.jpg, image_2.jpg and image_3.jpg are uploaded to a folder: media/myimages/


3. I then go to a product and select fx. image_1.jpg from the drop down


4. On the front-end image_1.jpg should now be visible as any other product image that has been added to the product.


5. If no image has been selected from the drop down, nothing should happen on the front-end.


I think it is point number 4 and number 5 where I need help. I am not a programmer so if you can point to some working code or some code that needs minor modifications to achieve my requirements that would be the best.



Re: Add product image to a product from admin drop down menu



Almost you're near to your solution. As you've choose images for your products into backend section. right ?


Now on frontend you already have product object on prduct detail page. Use below code in order to get your image. (Also do mage sure your created attribute has Used for product listing And Visible on Product View Page on Front-end Is YES.)


<?php $image = $_product->getName();?>

Replace getName() with your created attribute.


Hope this helps you, Good luck Smiley Happy

Magento Programmer | Was my answer helpful? You can accept it as a solution.