I'm trying to make a simple "Filter By..." option section for a View such that when someone wants to narrow results they can do so by clicking a checkbox or link and getting a shorter list, narrowed by their choice option. One sees this all the time in online shopping, where you filter products by brand, type of item, price, etc., to narrow down the list to something close to what you're looking for.

Is this done by creating (for example) 8 separate clones of the View, then adding a filter on each and linking to this new view?? Or can this be done as a function of the one lone View itself?

It's easy to see this working for "products" being filtered by "cameras," "lenses," "brand," and "price." 4 new clones with different filters added to each to display the properly sifted results. Link to the new sub-view and voila.

That was my approach. Then I realized the gotcha is that if I want to have "Lenses" and a "Price" category...or "Cameras" with "DSLR" or "Point and Shoot" AND a Price category...suddenly this gets to be a nightmare of dozens or even hundreds of cloned views.

I have a hunch that Drupal's got this covered in a far easier way. Is there a module that allows me to make a simple block that will have a toggle for different categories?

  • 1
    Do you know the very first. top-most option "Expose this filter to visitors, to allow them to change it" when creating a filter for views? – Hudri Jan 10 at 16:35
  • 2
    This sounds like a faceted search - I would advise using Search API, Facets, and potentially a Solr based backend for this. After that, it becomes one View with facets drilling down into the current result set. – Kevin Jan 10 at 17:11
  • @Hudri, this may be what I need. I looked and set up a simple one and it's not working as expected. My field is set up as either an "x" (exists) or null (doesn't exist), so I want to allow the user to get a list of ALL the items initially, then say "refine by X" or "exclude by X" The result I'm GETTING is a list that initially excludes the items without an "x" and if I type into the field and remove the "x" it shows a long list of ALL the items. I suspect I've got the syntax messed up? Do you see any alarm bells here? – user1149499 Jan 10 at 18:00
  • @Hudri, this was exactly my issue and the answer I needed. If you care to redo it as an Answer I'll be glad to give it the green checkmark. It took a while for me to figure out the options and what they meant, but this was all I needed. I figured it had to be something relatively built in. – user1149499 Jan 10 at 19:27
  • @Kevin I bet I could accomplish the same thing with what you describe but in my case, I was just looking for the simple tool and it WAS (whew) sort of baked into what I'd already had. I didn't know how to search for the terms properly but I just needed to use the "expose to viewer" options and allow a viewer to toggle this or that grouped value. – user1149499 Jan 11 at 1:43

Your Answer

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

Browse other questions tagged or ask your own question.