Vote up!
Vote down!

Multiple product attributes, but only one requires alternate images = PROBLEM

My Products are typical womens' dresses. Each product comes in two colours, Red or Black, and 5 sizes, 6 / 8 / 10 / 12 / 14

The red dresses have a different image to the black, and each product has about 5 images per colour. The different sizes per colour do not need different images - they obviously use the same image per size. Colour and Size both need to be selected as Product Attributes to make use of the Commerce Cart functionality.

There seems to be a HUGE problem with making this typical product setup streamlined in Commerce using Products and Product Displays. I'm keen to set it up in the "truest" fashion, ie, 10x Product entities covering all variations, all displayed in a single Product Display. But whichever way I turn (Bulk Product Creation, Inline Entity Form, or just creating Product entities manually), I have to upload the same 5 images for each of the 5 sizes and then do it all again for the other colour! That's a crazy system to present to the client.

It's like the system is tripped up when there's more then one set of attributes, particularly when only one set of attributes requires the change in image.

Not to mention I have to import legacy data of about 300 products using Feeds, but that another mind-f$%# all-together. At the moment I'm just wondering how this is DESIGNED to work in Commerce.

Any ideas??

Asked by: whitemope
on March 27, 2013


I've tackled the issue of only one product attribute needing a different image, and I always solve it very ugly. I have an image field on my attribute and then I have an image on the product display. I then display both on my node tpl. Then I use drupal javascript behaviors to test if the attribute image is there, and hide the product image. It's disgusting, heavy and makes me sad inside, but it gets the job done.

Edit: Check out the module filefield_sources to keep from having to reupload the image every time. I use this in conjuncture with IMCE


- drewbolles on March 27, 2013

Hey Drew - I dig what you're saying. Makes sense. Not pretty though! And I still can't really present that solution to the client.

It frustrates the hell out of me that all of Randy's video tutorials start off saying how great Commerce is, and how easy it is to incorporate Product Attributes, but then only ever demonstrate using a SINGLE set of product attributes. I'll give you Impishness! What kind of Commerce system can't deal with multiple product attribute sets well? A crappy one!

- whitemope on March 27, 2013

4 Answers

Vote up!
Vote down!

I believe the Drupal community is happy to offer free support to Drupal Commerce users dealing with real world problems implementing the software, but shouting about how crappy the software is is no way to engender those feelings of helpfulness.

What you're dealing with is a general Drupal problem related to the handling of duplicate media content on a site. In your case, the Filefield Sources module may be all you need, as indicated above. You might also look into modules like Media, Scald, and Asset.

The fact that none of the videos you've watched demonstrate your particular use case does not represent impishness (really? have you met Randy?) or an inability / lack of desire to accommodate a use case. It just means the video was made to show what it shows, and it's up to other community members now to solve the additional use cases and demonstrate for others how to solve them. We'd love your help in doing so.

Ryan Szrama
Answer by: Ryan Szrama
Posted: Mar 28, 2013


Hey Ryan,

Thanks mate. I get my tone and what I said wasn't in the spirit of opensource, my sincere apologies. But it's so frustrating and very time-consuming for the official instructions from the developer say it can do one thing (in this case, attribute + image handling) but give no hint of the immediate limitations - so after a week of working with the software, following the tutes, and hitting walls, the temper tends to boil over. Limitations are totally expected and understandable, but it sux to have to discover them after days and days of work.

I would love your advice on how I need to set up the following product type:

A typical Dress, available in Red or Black each with a set of 5 images, and each colour available in sizes 6, 8, 10, 12, 14. Set up in such a way where the client needs to upload/attach each of the 10 images only once (and ideally creating the entire product display using a single form). And so that selecting the colour attribute on the Display node changes images, but selecting the size attribute does not change image.

Your help would be hugely appreciated!

- whitemope on March 28, 2013

Regardless of the poster's tone, the problem persists. And could be solved with the current structure of Drupal's entity system, maybe by combining more than one entity per product (like an entity to keep colors, another to keep variation-specific attributes like size, etc.)

- Sinan Erdem on May 8, 2013
Vote up!
Vote down!

I feel your pain! Commerce seems like such a great payment system, but this is a major limitation, which I too was surprised to discover.

I am developing a clothing site for a client and can't possible present the option for adding products in the way that Commerce suggests.

I'm using the bulk creation module. Most products have attributes like:

sizes: XS, S, M, L, XL
colours: black, white, red, blue, green

That's 25 individual image uploads for one product!

With about 100 initial products, I have to ask my client to upload 2500 images (2000 of these duplicates), just to get their shop up and running!

Has anyone found a decent, client friendly solution for how to tackle this with Commerce?

Answer by: djh007
Posted: Jul 12, 2013
Vote up!
Vote down!

I have the same problem...

I have two questions:

- Is the system able to know if the same image has been uploaded twice? I ask this question because I'm curious to know if the system really upload inside files directory 2000 duplicate images in djh007 scenario.
- If I install IMCE module, can I been able to select same images on the server without multiple uploads? I believe that can be part of a solution.

Thanks for replies


Answer by: Brennino
Posted: Apr 18, 2014


Currently, the only possible solution is to use filefield_sources to not duplicate the images. In any case, if a user has to load 100 products with 5 colors and 5 sizes, he must still select every single image through filefield_sources.

I'm trying to figure out if it's worth developing a simplified interface for loading products.

I've also opened an issue on Commerce 8.x, it seems to have the same problem: https://www.drupal.org/project/commerce/issues/2924065

- FINeX on November 16, 2017
Vote up!
Vote down!

Any conclusion for this.

Answer by: avin
Posted: Jan 23, 2017