Discussions

Structuring Product Variants

Hi,

I'm a new to Drupal Commerce and trying to figure if it is suitable for our current project. Details as follows.

Our client sells a variety of electrical fittings. Each fitting has a name, description and picture. No problem there. However there are up to 10 variations for each fitting. The vraiations themselves "vary" but include such features as color, size and size. For example:

________________________________________
Name: foo

Description: polycarbonate widget

Image: [pic]

Code, Wattage, Size , Color
1234, 2x13 W , 10x50, white
1235, 2x13 W , 10x50, black
1236, 1x55 W , 10x50, white
1237, 1x55 W , 10x50, black
________________________________________

Understandably, our client does not want to enter name description and image 10 times.

I can easily configure the product for multiple: codes, color etc. However, that doesn't really seem like a properly structured approach.

Thank you

Regards

Brett S

Posted: Mar 7, 2011

Comments

BrettS on March 8, 2011

I have been trying to add a "line item" to a product without any success. Can someone tell me if a am even trying the right things please? This is what I have tried:

Created a product called "Parent Product" with a "Line Item Reference" called field_line_item.

Created a product called "Child Product" with a "Product Reference" called field_parent that can reference "Parent Product".

Created one instance of "Parent Product" with SKU or "arc"

Created 2 instances of "Child Product" with field_parent values of "arc"

Now, in the "Parent Product" I can see an artifact called "Line Item" (field_line_item). Underneath, I see a dropdown list with only one selection ("Product") and a button "Add Line Item". When I click on "Add Line Item", the message "please wait" appears for a second and then disappears. I had hoped to see a selection of "Child Products".

Any suggestions?

Thanks

Regards

Brett S

Scott J on March 8, 2011

Line item is definitely not what you want. Delete all and start again.

Follow the example at http://www.drupalcommerce.org/node/295

Store->Products->Product types->Add product type->Name:Widgets
Click "Save and add fields".

Add new fields for Wattage, Size and Color
Each field should be Type: List (text) Form element: Select list and marked 'Required field'. Fill in 'Allowed values list' with appropriate values such as 2x13 W and 1x55 W for wattage field, 10x50 for size field, black white for color field.

Store->Products->Add a product->Create Widget
Add new products for SKU 1234, 1235 etc. and select appropriate options from the lists. At the moment 'Title' field is required. You should request that this is not required at http://drupal.org/project/issues/commerce

Next you need to follow http://www.drupalcommerce.org/node/293

Structure->Content types->Add content type->Name:Product display
Click "Save and add fields".
'Add existing field' Image:field_image
'Add new field' Product reference Type:Product reference

Add content->Product display
Here you can fill in Title, Body and Image only once as per your request. Product reference field will be 1234,1235,1236,1237 etc.

Brett S (not verified) on March 9, 2011

Hi Scott,

Thanks for your reply.

I followed you instructions and am now almost there.

The only problem is that under the Product Reference area

I can see the SKU, but none of the other attributes (such as color and wattage)

What I want to create, is a table like this:
SKU Color Wattage ...
123 White 50 ...
124 Blue 50 ...

Incidentally, this is a view only catalogue (no shopping cart). But the user does need to see more than the SKU to know what they are looking at.

Once again, thank you.

Regards

Brett S

Scott J on March 10, 2011

I also had that problem at first. They should show as select lists.
Ummm...

I think it was because I didn't have 'Required field' checked for the color/wattage/whatever fields?

bhosmer on June 5, 2011

Has something changed since this was posted?

I created a product type in the store: Bath and Body

I have variations of these types: Soaps, Body Butter Etc.

Each Variation can have a scent: Flower, Sweets, etc.

I created products with unique SKU's for each variation: Soaps>Flower Soaps>Sweets

I now add a new node "Product Display", and want to let the user select a type of soap and a scent for that soap as well.

I can only enter one SKU though.

The error if I attempt to enter more than one product reference like this: 001, 002, 003

Product Reference: this field cannot hold more than 1 values.

EDIT:

I feel silly, my product reference filed in my product display was not set to "unlimited".