1

User story: The end-users should be able to pick an image from an image gallery and attach that image to a product before adding it to cart

In Commerce v1 this was possible via line items by defining an entity reference field, along with a couple of other modules e.g. entityreference view widget. A sample, although not 100% finished, can be found in d7demo when you click on the 'add item' button.

I used entity reference since the images are actually nodes with a file field, so that i could also categorise them via term references.

Is the above functionality somehow possible on commerce v2? I cannot find 'line items' as used in v1, but only attributes and variants. However i cannot seem to find the way (configuration or contribs) to achieve the above functionality.

Any pointers to the above issue are very much appreciated.

3
  • You should clarify your question. Reading it, I am unsure whether you want to select an attribute using an image (fancy attributes) or allow the customer to upload an image before adding the product to cart (exposed line item field, nothing to do with product attributes). – Bojan Zivanovic Oct 11 '16 at 12:32
  • Bojan thanx for your reply. I rephrased my initial question making it hopefully more clear. – Giannis Pagonas Oct 11 '16 at 13:51
  • 1
    Line items are named "Order items" now, and work in a similar way as commerce_customizable_product worked in D7 (attach fields to an order item type, expose them on the add to cart form by using the the "manage form display" tab). – Bojan Zivanovic Oct 11 '16 at 13:55
1

Since product attributes are entities in CommerceV2, the following module should cover your needs => https://www.drupal.org/project/entity_browser

Some points to consider:

  • It is still in alpha
  • It is strongly supported at the moment by the community and especially the Drupal Media Team
  • It has more than 5K downloads.

There is also a recent presentation available from DrupalCon Dublin 2016 => https://www.youtube.com/watch?v=VXor-HZiYrs

Update: Following the documentation, you may also need to look into "Product Variations Fields", http://docs.drupalcommerce.org/v2/product/products.html.
This CV2 functionality seems to allow you to expose specific fields to the end-user for e.g. uploading images in order to modify/configure a product.

Good luck!

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.