1

Using Drupal Commerce you can set fields in the product entity which can function as attribute selection fields. The visitor can use them to switch the variations of a product.

I created a field called SIZE which allows the visitor to switch the variations of a product. This works fine. Now I need to allow to change the variation by clicking in a image of the variation. See my capture to get the idea.

I create an image field and set it to 1 value, but the "Attribute field settings" area didn't show up. In this area you can check "Enable this field to function as an attribute field on Add to Cart forms."

I thought this module could help, but as far as I see it is not useful for this: https://www.drupal.org/project/commerce_fancy_attributes

enter image description here

  • I'm not familiar with Drupal Commerce, but to output an option field into a rich menu, you'll have to use javascript. Just like you've created the Size field, create a field called "Color" and add the options "brown", "red", "green", etc... and on the front-end, have javascript replace the select field with images. Then, in the background, have javascript select the color based on what the user clicks. – timofey.com Nov 28 '14 at 8:39
  • One aspect of your setup you did not say. Are you using a view to display this or is this a node display for the products? – Brady Nov 30 '14 at 10:03
  • It´s a node display of the product. – chefnelone Nov 30 '14 at 13:57
  • 1
    I think here you need to add some css 3 or javascript. Means display the radio buttons and change radio button as images. – Sumit Madan Dec 1 '14 at 4:35
  • I don't think you'd be able to use an image field as a product attribute, it's more applicable that you would use radio buttons and use JS to change the view of the button as mentioned by @SumitMadan. Without trying, you might be able to create a colour taxonomy, add an image field to the taxonomy, and then add the taxonomy to your product display, you should then be able to use some JS to replace the text with an image – Andrew Morris Dec 2 '14 at 11:35
0

Try using Commerce Fancy Attributes along with Field Extractor Module

This module provides:

  • A formatter for reference fields
  • A views field for reference fields (called "Field extracted from entity referenced through $field")

This module uses field_view_field hook

Returns a renderable array for the value of a single field in an entity.

The resulting output is a fully themed field with label and multiple values.

  • It seems to be a good idea. I'll try it. – chefnelone Dec 4 '14 at 17:16

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.