OR condition in Views Contextual Filters

Solutions

Drupal 7:

If using D7, then consider module Views Contextual Filters OR (which only has a dev version today). Excerpt from its project page:

... provides a views plugin which modify query to support OR conditions for contextual filters.

A few issues on Drupal.org that may be of some help:

  • Using OR in filters breaks contextual filters.
  • Views AND/OR Contextual filters two ways.

There is also this comment in the support forum.

StackOverflow.com contains yet another approach to consider as an alternative.

Maybe you should look at Alter a Views query to use "OR" through the user interface also (it might help to change change your mind about the Views Contextual Filters OR module anyway). Because 3,855 reports installs of that module is not nothing, right?

Drupal 6:

If you're still using D6, then maybe module Views OR is what you are looking for? Excerpt from its project page:

By default, each record in a view must match all filters. Sometimes records need to be included if they match one or more filters in a list of alternatives. Views has the ability to combine filters only with AND. If one filter is false, the combined list will be false. Views Or adds the ability to combine blocks of filters with OR. If one of the filters in the block is true, the combined block will be true.

Note about the "my website is too big" ...

That's perfectly understandable. But that also implies that you should really invest in setting up some kind of testing / staging environment where you have like a mirror of your production environment. So that in THAT environment you can safely experiment / review / finetune what's needed, without impacting your production environment. And after you found the fix in that environment, you should have a process in place to actually MIGRATE it to the production environment ...

A pretty forward (simplistic) approach to this is to transform your existing production site into a multi site setup, whereas you do not change anything to the production site version, but you just add 1 (or more) sites like 'test', 'QA', 'User Acceptance Testing'. These extra sites mostly use the same code base (as production), but with their own copy of the Drupal database. And code changes (or extra modules to be added), first go in site specific subdirs. After they get approved, they are "promoted" to the "all" subdir.

Tags: Views

Similar questions

How to set the filter condition by default for specific condition in view
How to set the filter condition by default for specific condition in view i,e i have view with the filter condition STATUS drop down list has 1]live 2] discard,so here i want to filter by default for live status when i open this view can any please tell me how to do this? Thanks a lot in advance.
Drupal 7 OR condition with a series of AND condition
I have a `Drupal query like below I would like to add an OR condition to this query. So it will be a global OR condition. I added a code like below But it didn't add an OR condition but put the condition query within braces in an AND condition. How can I achieve an output query like by using Drupal query builder? Please help
Views exposed filters - how to show "You searched for [exposed filters]" above results?
I'd like to summarize the current filters used on the data in the results. What's the easiest way to do this? Thanks!
Adding custom classes to Views Filters (view-filters) and Content (div.view-contents)
I'm using a theme that includes bootstrap. I'd like to inject class one_third into <div class="view-filters"> and two_third last to <div class="view-content">. Is there a way to do so from any theme theme_preprocess_area? I know I could accomplish using javascript (selecting div.view-filters and addClass()), but I think it would be most...
How to break views exposed filters into more than one block. ie break few filters in one block and rest in another block?
I have four exposed filters in a view. I want to create 2 blocks of exposed filters. I want 2 filters in one block and other 2 in second block.
drupal 7 views exposed filters How to replace the word "any" in all filters of a form
i want to replace the word 'Any' by 'Indifferent' in all the dropdown selectors of a view exposed form. So i used this topic to build a module called replaceany . views-exposed-form-search-page-page is the id of the form , not the name of a field . is it correct ?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.