I have created a page view that displays customer nodes. The result is filtered by a contextual filter based on a taxonomy term id from url. To allow multiple filter values i'm using OR (+) and AND (,) operators in the url. However, combining those operators doesn't work.

Url's like this work:

  • /finder/220+300+121
  • /finder/220,300,121

This doesn't:

  • /finder/220+300,121

So i'm looking for a view setting or a module that allows multiple OR/AND operators. Here is a screenshot of what i'm trying to build.

Show me all customer nodes that are in industry3 OR industry5 AND are from Product1. This would be this url: /finder/220+300,121

enter image description here

Any ideas? Thx...

  • Might be better to use exposed filters rather than contextual if that's possible for you. So it would be something like /finder?industry=123,124&product=1 – Leigh Jul 4 '18 at 8:10
  • Can you elaborate a bit on this (as an answer), i just tested it and i think you are right. I'm now looking into the module better_exposed_filters to get the checkboxes instead of the autocomplete widget. – kevinius Jul 4 '18 at 8:48

So I think you should remove your contextual filters and instead add exposed filters. In there you can make your industry filter multi select so the user can pick more than 1. Then you can also choose to make the filters an either AND or OR giving you that flexibility too.

If the exposed filters or the better exposed filters don't look as you wanted you could even hide the views filter form and created your own custom form that replicates it by passing the parameters into the url that views requires

Hope that helps!

  • Is 'hiding the views filter form' a view setting, or do you mean hide it using CSS? – kevinius Jul 4 '18 at 10:10
  • That was via css, if your stuff in views in a page you can tell the exposed filters to appear in a block and then just dont add the block to the page. Or if your thing within views is a block its self then you dont get that option and you could just use css to hide it – Leigh Jul 4 '18 at 11:01

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.