Closed (fixed)
Project:
Commerce Fancy Attributes
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Mar 2013 at 07:24 UTC
Updated:
3 Feb 2014 at 14:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kevster commentedHi jbova - this sounds like just what Im after. Can you elaborate please?
I have a product display where I want to show an add to cart ref field as an image pulling through from the commerce product instead of a drop down product ref or a taxonomy ref field as the standard fancy attribs does.
Are you saying that I can do this by creating an entity ref field on the commerce product and then pointing to the standard commerce prod image field or do I need to create a new image field but as an entity ref and then on the product display create an add to cart inline entity multiple values field?
I have set up several sites using fancy attribs and also multiple prod ref drop downs on the prod display but this one has got me right now...
Any help would be much appreciated, I have been trying for several hours to get this set up but its not working out. I have applied the edit above. Thanks in advance!
so something like this?
Example usage:
0) Enable fa module, apply edit to module as above
1) Add an image entity field to a product type?
2) When you add the new field on the product type, tick the checkbox "Enable this field to function as an attribute field on Add to Cart forms." and select "rendered term" as option of the "Attribute selection widget".
create several commerce products from this product type.
3) Go to your product display and add a product reference field and choose your new image entity ref field?
4) Create a new display product and add several commerce prods, save and see the add to cart inline entity field as a series of images that when selected switch the display details of the commerce product
Comment #2
jbova commentedkevster,
That is very similar to what I'm doing. I have two vocabularies, "Scent" and "Scent Color" with fields as follows:
Taxonomy Terms
Product
Lastly, you may either want to create your own custom module based to Commerce Fancy Attributes, or a module to override the
commerce_fancy_attributes_process_radiosfunction incommerce_fancy_attributes.module.For example, in my case I needed to update that function as follows to add a wrapper around my rendered items with a class noting which was selected. This was mostly so I can stylize the background of the fields using CSS:
This could have likely been done with a field template, but I was pressed for time.
Lastly, it was very important to use the Field Extractor module in this case to render the Scent Color, which was referenced by the Scent, which was referenced by the product. So, on my Taxonomy Term settings for the Scent, I have the following set:
The resulting product display can be viewed here: https://www.machsgutcandlebarn.com/product/24-ounce-jar-candle
The reasoning behind my use of Entity References, was because I didn't want to add every single color swatch to every single scent of every product. In my use case, the colors are referenced by the scent, which are in turn referenced by the product. So, this was a major time saver. The colors, in this case, are determined by the scent chosen. There are over 200 scents, but only 8 colors.
You may be able to accomplish what you want by only making the change to Commerce Fancy Attributes specified in this Issue Summary, and pairing it with the Field Extractor module.
Jim
Comment #3
jbova commentedBy the way, I missed a part of your question. You cannot use the standard image field on the product entity. Instead, you need to create a taxonomy vocabulary for your products. The image field should be added to the taxonomy term fields. On the product, not the product display, you would add an entity reference field. This entity reference would reference your taxonomy term.
Images themselves do not serve as product attributes. You can only use fields with a defined list of options as attributes on the add to cart form (see http://www.drupalcommerce.org/user-guide/product-attributes-variations). Therefore, you must use a field with a defined set of options, such as List(text), Term Reference, Entity Reference, etc... You may not use a text field, or an image field.
With Commerce Fancy Attributes, even with the patch I mentioned in the issue summary, you are limited to using a Term reference, either by choosing "Term reference" or "Entity reference" and being sure to choose "Target type: Taxonomy term".
I understand the feature you are looking for, but I don't think this module provides the simplest solution. If I understand correctly, you are intending to have the standard product image as a single valued field on the product. Then, you want the product display to display one image per product variant. Finally, when a visitor clicks on the image, it would update the page to display the product represented by the image clicked.
You can accomplish a similar visitor experience using Commerce Fancy Attributes, Taxonomy terms, and Field Extractor, but your initial setup is going to be more complex. In addition, you'll want to utilize the VBO and Commerce BPC modules to streamline the data entry.
Comment #4
zmove commentedThe jbova solution to support entity reference works. It would be great to see it commited as it's just one line of code to change.
Comment #5
plachThe solution proposed in the OP works perfectly here. Rolling a real patch.
Comment #6
bojanz commentedCommitted, thanks guys.