Discussions

How commerce is designed for following two things

Dear commerce devlopers and advances users.

Can you please explain how commerce is designed for following things:

1. Product entity can have multiple fields - this is very nice. What if I need all products from one Product Display to have same image? It is not ok for user to upload image for each product entity... So the way out is to add field to product display and it is just fine, except Views in cart which cannot display this image as there is no such relationship which can achieve this :/

2. I now that for each attribute combination you need to create its own product entity. From one point of view this could be annoying but it gives flexibility to allow different prices, images etc. So we can create submodule which will do batch job for autoupdating products. The question is, what if I need to have not one dropdown with attribute selection but as manu as manu attributes I would like to represent? I need to have color, size and texture. So to have one dropdown is overwhelming for end user srolling non user friendly list. Is there a way I can organize it to many dropdowns as Ubercart did?

I would appreciate any ideas and thoughts about this...
Thank you in advance.

Posted: Feb 20, 2012

Comments

stef on February 23, 2012

1.you need 2 relationships, i paste here my setup (its my language, where obsah=content)
(Produkt) Obsah: Product
(Produkt) Commerce Product: Obsah referencing products from field_product
now add image ;)

2.go to your product type, and on each field u need as options on product display, tick "Enable this field to function as an attribute field on Add to Cart forms". Then check if its not hidden in product/product display and it should works

chaugi on February 24, 2012

Hi, thank you very much.

2. Got it the way you described it.

1. Well actually everything is a bit different.
We have views: commerce_cart_form
It has type: Commerce Order, so Content filed nodes are not available directly.
So what we have to do we have to build following relationships:
a) Commerce Order: Line items
b) (Line Item) Commerce Line item: Product
c) (Product) Commerce Product: Node referencing products from field_product
No we can have field from Node (Content) which has desired image field.

stef on February 24, 2012

i thought Commerce Order: Line items was there by default, thats why i posted only 2 and 3 relationship. I needed same solution, because i use http://drupal.org/project/commerce_add_to_cart_extras to show all available products in a table and there is no reason to switch atributes via radio buttons or dropdown menu. (My client told me radio buttons or drop down menu for choose atributes is too complicated for people :)) )