Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We need a Facet API Display Widget that can list fancy attributes (like colors) as clickable facets in the search results.
Reference: http://www.drupalcommerce.org/questions/7388/color-fancy-attributes-face...
Comments
Comment #1
jsacksick CreditAttribution: jsacksick commentedThis patch creates a facetapi display widget that inherit from
FacetapiWidgetLinks
, you just need to select the display widget and it will work if you use commerce_fancy_attributes for your taxonomy vocabulary. I added an option that allows you to choose whether or not you want to display the facet count.Comment #2
jsacksick CreditAttribution: jsacksick commentedbetter with a non empty patch :)
Comment #3
joshmillerjsacksick,
I've not had a chance to actually take the code for a run, but what follows are two minor comments that you can take or leave.
Perhaps the text-shadow is enough. Or perhaps we could do something more like the following:
It would require more advanced markup output to achieve the above with css.
I would recommend a different #description ... perhaps, "If checked, the number of matching products will be output with the color square.
Comment #4
jsacksick CreditAttribution: jsacksick commentedAttached patch has an updated description and wrap the facet count into a span to help theming.
Comment #5
joshmillerThis is the code that will make it look pretty :D
And this is the HTML I was working with...
Comment #6
jsacksick CreditAttribution: jsacksick commentedThanks a lot for your contribution josh ! I updated the css and I'm displaying the facets count on hover :).
Comment #7
jsacksick CreditAttribution: jsacksick commentedAdd a newline at the end of the css file.
Comment #8
jsacksick CreditAttribution: jsacksick commentedThe 7 patch includes in the diff a previous patch by mistake...
Comment #9
jsacksick CreditAttribution: jsacksick commentedI committed the patch to dev.
Comment #10
heyyo CreditAttribution: heyyo commentedAfter I applyed the patch from #8 I don't see any new display widget on my facet display configuration.
Is there any thing to do before seeing it ?
Comment #11
jsacksick CreditAttribution: jsacksick commentedDid you clear the cache ?
Comment #12
heyyo CreditAttribution: heyyo commentedYes I did clear the cache. I tried it on a fresh kickstart.
Comment #13
jsacksick CreditAttribution: jsacksick commentedWell then you either didn't apply the patch correctly (Switch to the dev version) or you're trying to update the display widget on a wrong facet. I tried the patch on Kickstart, you should see "Fancy attributes" in the list.
Comment #14
heyyo CreditAttribution: heyyo commentedSorry not sure to understand,
I have to apply the patch Commerce Kickstart Dev too ? Commerce Kickstart 7.x-2.4 is ok too ?
To update the facet i'm using the link from the all products page.
Comment #15
jsacksick CreditAttribution: jsacksick commentedNo you have to either apply the patch to Commerce Search api 1.0 or switch to the dev version of Commerce Search API.
Comment #16
heyyo CreditAttribution: heyyo commentedStrange I tried both. I will check again.
Comment #17
heyyo CreditAttribution: heyyo commentedNow it's working by applying the patch, I really don't know why it wasn't the case before.
Could this patch could also work with a color field(http://drupal.org/project/colorfield) in addition to the regular text field provided by Kickstart ?
Comment #18
jsacksick CreditAttribution: jsacksick commentedNot for now, Commerce Fancy attributes will rely soon on Colorfield, at this point I will modify the code, but I follow Commerce Fancy attributes.
Comment #19
heyyo CreditAttribution: heyyo commentedI finally did it by replacing the type 'commerce_fancy_attributes_color' by 'colorfield_color_swatch' and ['value'] by ['rgb']
Comment #21
oscar_arnulfo CreditAttribution: oscar_arnulfo commentedI can't get it work, can someone help me, i tried everything and nothing.
When i select Fancy attribute in display the color block it shows the HEX color text and the count but not the color on facet, when i click it throws this error