Tags/topics: 
2
Answers
Vote up!
0
Vote down!

Realization problem : How to create a product with selectable values

Hello, I started on Drupal.

I would like to create a page where the user selects some items which all has a price. Once the selection is made, the user adds the order to the cart.

example:

A combo with a choice between :
- Cake type (3 $)
- Pie type (2 $)

Another combo with a choice between :
- Chocolate sauce (1 $ )
- Caramel sauce (1 $ )

A MultiCheckbox with several choices between :
- Vanilla supplement (0.40 $ )
- Strawberry supplement ( 0.60 $ )
- Nougat supplement (0.10 $ )
- Cream supplement ( 0.20 $ )

A price label that displays the real-time pricing of the user selection .
For exemple, If this selection is : cake type, chocolate sauce, strawberry supplement , nougat supplement, cream supplement.
Then the price should display : 4.90 $

A user click on the button "Add to Cart " adds that control the amount of 4.90 $ to cart

So I chose to use the Drupal Commerce module.
I can see the different elements of selection , but the problem is that they are not related .
I get an "Add to Cart" for each item (one type, one for sauce, for a supplement).
Plus, the price is not added , it takes into account only the element that has been selected .

Have you any idea how to realize that?

Thank you for your help

Asked by: romsVLM
on April 29, 2014

Comments

If you have used Commerce Kickstart2, the structure is there to do what you need, I think (but I am just starting too!).
The basic steps would be to set up your "product variation type" -from your description, that could be "dessert".
BUT FIRST, You'll need to set up three "vocabularies" --these would be the pudding (cake or pie), sauce(choc/caramel) and supplement(vanilla/cream/...)
--go to Products->Categories and add the items pudding, sauce, supplement to the list.
--On the new "pudding" item, we hit "list terms" and add some: cake, pie,...
--repeat for the other "Vocabularies" e.g. sauce and supplement.

NOW You create a Variation Type in "Store Settings->Variation Types".
--Check the three boxes: Revisions, SKU, Create matching product display type.
--Click "Save and Add Fields" (Now you are editing the Product Variation Type "Desserts".
--You can manage its "Fields" -- here is where you'd add a field to select "Cake or Pie" -we called it "pudding".

--You could also add other fields which you mention e.g. "supplement type" or "sauce" (we will get to the types of sauce, [and cost of each] and puddings [and cost of each] in a minute).
--So, And add a NEW field for "pudding" (Field Type:Term Reference, Widget:Select list, Vocabulary="pudding") and repeat for the other options.
--when you're adding the new field (e.g pudding), check this box: "Enable this field to function as an attribute field on Add to Cart forms". (may be in the "edit" tab). Save.

Ok, you're almost there...you need to manage the display of your fields..to make sure they show up to the customer.
In Content->Content Types->Desserts->ManageDisplay make sure you have Custom Display Settings (a drop down list at the bottom!) for: Default,Full Content.

Manage Fields / Manage Display:
basically make sure your new fields are visible on the various views you use "node full content" (for example--this is the main product page for desserts)

Now, when you add a new product for people to purchase - e.g. "take-away-sweet", you make take-away-sweet of the type "dessert". As you create variations, you will be prompted to add a separate price for each change in pudding,sauce, or supplement.

If you have many, many variations it is possible to create pricing rules which add increments for each option.

Sorry if that's too opaque. I'm a noob using CK2.

- electroweak on April 29, 2014

Thank you for answering, I've followed your instructions, but the result is not as expected.

I want the user to choose his own dessert by selecting a cake, a sauce, and supplements (supplements with MultiCheckbox).

The solution you propose is used to create desserts in advance, and then to propose them to the user... but this is not what I want.

Do you have another idea?

- romsVLM on May 7, 2014

2 Answers

Vote up!
1
Vote down!

Try the Commerce Pricing Attributes module. It will enable you to set up custom attributes, such as cake, sauce, etc., and assign a price modifier to each value. The price will be automatically calculated in the line item total, based on the combination of attributes.

Answer by: Brylie Oxley
Posted: May 16, 2014
Vote up!
0
Vote down!

Thank you for answering, I've followed your instructions, but the result is not as expected.

I want the user to choose his own dessert by selecting a cake, a sauce, and supplements (supplements with MultiCheckbox).

The solution you propose is used to create desserts in advance, and then to propose them to the user... but this is not what I want.

Do you have another idea?

Answer by: romsVLM
Posted: May 7, 2014