Skip Navigation

[Resolved] view with user search: all checked items must be fulfilled

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 5 replies, has 2 voices.

Last updated by Beda 5 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#1598343

suppose i have a list of vacation rentals. i created a view that enables the user to be able to filter by features, e.g., nice view, air conditioning, pool, elevator, washing machine, no smoking, etc. if the user checked the boxes for air conditioning and pool, the results show rentals that have air conditioning, and rentals that have a pool - but what i want to show is rentals that have both air conditioning AND a pool. how can i achieve this? thanks!

#1599061
Bildschirmfoto 2020-04-24 um 18.34.05.png

If you're lucky all those details are post Fields (custom fields)

Then, in your View, you simply need to insert all the search fields you want, and then in the Views Query Options, you can choose AND/OR for the relationship.
See also screenshot

Note that this is not possible in Blocks
I've asked DEV to add that to blocks as well.

#1599669
1598343.PNG

hello,
but isn't this a setting when the admin is setting up the view ("display all results: the view will output all the results returned from the query section")? how do i specify the "AND" when it's the *visitor* who is controlling the results based on what (s)he selects from a set of checkboxes ("display the results using a custom search: visitors will be able to search through your content using different search criteria")?
(please see attached example.) thanks!

#1600331

It is a setting, as I show in my screenshot, but that is the classic views editor.
The blocks editor does not have that option and I requested it to be added.

The setting is only available for Post Fields Searches.
Not for Taxonomy Search or else.

"display all results: the view will output all the results returned from the query section"
This is just a setting to decide what you'll do with the View, it is not related to Query Filter Relationships like AND or OR

As I mentioned, you specify the and/or as seen in the screenshot in the Query Options, but that will only be possible in classic Views.
If you select AND (which is the default in the classic view but not blocks) then it'll show results to the user that have ALL search terms (and) - if you chose OR, it will display results that have EITHER search terms

In blocks that is the default and can momentarily not be controlled

#1603193

hi, beda,
how do i switch to "classic views editor". i don't have the "blocks" component installed - only "types" and views". thanks!

#1603679

Hi Peter

To create a View in the "classic" editors, you'd need to:

1. Install Toolset Views Plugin (instead of Toolset Blocks)
2. In Toolset > Settings > General > Editing experience, choose "Show both the legacy and Blocks interface and let me choose which to use for each item I build" (or "Show only the legacy interface for designing with shortcodes" if you only want classic)
3. Now in Toolset > Views, you should be able to add new Views, which will feature the settings I outlined earlier

In the case you chose "Show both the legacy and Blocks interface and let me choose which to use for each item I build", you will still be able to design the views LOOP with the Gutenberg Editor and with Toolset Blocks (as those are incorporated in Views too.

Please let me know if you need more help with this!