When I enable "links with checkboxes" type of facet, I expect that clicking ON the link will reset all other active items for this facet, while clicking on checkbox will expand the list of items for this facet. I think most of users expect the same.

E.g. I have a tree:

[ ] Jeans (21)
[ ] T-shirts (17)
[ ] Shirts (10)

(taxonomy facet with OR operation)

By clicking on the LINK (not checkbox) jeans and than clicking on LINK "t-shirts" I expect the "jeans" facet to be removed (so clicking on links works more like browsing through categories, one by one) while clicking on CHECKBOX "jeans" and than adding "t-shirts" (by clicking t-shirts checkbox) I expect to widen the search set.

Is that possible to do?
Thanks a lot in advance.

Comments

cpliakas’s picture

Title: Facet links with checkboxes usability » When using the checkbox widget, clicking on the actual facet link should reset all other active items in the facet
Category: task » feature

Hi restyler.

Thanks for posting your use case.

I expect that clicking ON the link will reset all other active items for this facet, while clicking on checkbox will expand the list of items for this facet. I think most of users expect the same.

I actually haven't seen this pattern before (probably because I wasn't paying attention to detail). Could you point out some other sites with faceted navigation that have this functionality? If this is a common pattern, I want to get an understanding of how other search-enabled applications are using it.

The short answer to your question is that I am sure it is possible to do, however I am not sure the best approach on how to tackle this. Give me a little time to think about how best to accomplish this.

Thanks,
Chris

restyler’s picture

Hi cpliakas,

thanks for reply. I tried but I couldn't find any website that will be a good example of that kind of navigation :(
May be you can give me some ideas what's the best way to do the stuff?

As far as I could see, just extending FacetapiWidget class (to create custom version of links widget) is not enough since the actual urls generation is already done at the time when data gets into class methods, but may be I'm wrong?

restyler’s picture

Any feedback?

cpliakas’s picture

Hm...

You are right that the query strings are already generated by the time the widget is run, however you are really generating two links anyways. So I would approach this by implementing a new widget (like you mentioned) and then generating the query strings for the actual link at query time. You may have to get creative and implement your own query building logic, however if won't be that bad and you can also use the technique that I outlined at http://drupal.org/node/1393928#comment-5494036 to perform this logic.

Sp specifically, you will have to replicate the functionality of the FacetapiUrlProcessor::getQueryString() method with the change listed above. You have access to the full render array for facets in the widget plugin, so even if you have to do some work you should have the flexibility to manipulate that array to accomplish your goal.

This would be a great contribution as a separate module to D.O.

Thanks,
Chris

cpliakas’s picture

Component: Code » Contrib
Category: feature » support

Changing to a support request an flagging with the "Contrib" component, because unless this is a common design pattern then it probably won't get into module. I do want to make sure that contribs can be implemented in order to achieve this functionality.

cpliakas’s picture

Version: 7.x-1.0-rc2 » 7.x-1.x-dev
Category: support » feature

Not sure why I marked this as a support request. I still think that Contrib is the right place for this, though.