I have an existing e-commerce application,that allows the admin to upload image of products.

As of now,the feature allows only single image upload for a product available in multiple colors.The colors are uploaded as simple csv format by admin.

Business requirement has changed and the business wants that on change in dropdown for color of a product the image of the product shown in the catalogue across the application be of the same color as that selected from the dropdown.

4 Answers
4

You can store the different images with filenames like product.color.ext and when the state of the dropdown changes, append that ending to the filename (e.g., shirt.red.jpg, shirt.blue.jpg, etc.). There are multiple ways to do it, that could be one solution.

On the left, there is Photo & Illustration Filters where you can specify a hex colour for your search filter.

As @Ankit says there are many ways to implement this. The most obvious thing you have to do of course is store the colour information of each product along with other product attributes and accordingly then you can do a search.

See this post on how to store a colour in SQL. (From that post it's an int) You could either have one single color property, or maybe a fixed number of colours : Product.Color1, Product.Color2 or a List according to you requirements.

If you want to go all ninja and be able to determine the colours of each product image automatically when it was uploaded, look at these post and their related posts :

Since you haven't posted any code. Based on your description, I am assuming that you are using ASP.NET. If this is the case you can use Themes And Skins to achieve this. Just set the skin programmatically depending on the selected default color setting that you have in your database.

I don't understand your question, or what the business requirement is.

It's clear that something should happen when a user changes which item in a drop down is selected. The results of this change are what I don't understand.

Is this like a customer facing page and you want the image to change for that particular customer?
Or is this like an administrator page, and you want the image to change for all users of the site (i.e. the drop down classifies metadata that image X is of color Y)?