Skip Navigation

[Resolved] Creating Custom Archive Search using And instead of Or

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Minesh 1 year, 3 months ago.

Assisted by: Minesh.

Author
Posts
#2651269
Screenshot 2023-10-09 at 3.05.29 PM.png
Screenshot 2023-10-09 at 3.05.11 PM.png

We're creating a new site that makes heavy use of Toolset Types and Blocks to manage our custom types. In this case we have a type called "Places to Study" and want to create an archive search that uses two filters - a set of checkboxes that pull from a "Place Features" taxonomy and a dropdown field that uses a "Locations" relationship.

This mostly works as expected except that users who choose more than one filter option (from the checkboxes or from the dropdown) get more results rather than fewer, because the query is using "and" logic instead of "or" logic. We'd like to change that behavior so that the more specific the search, the fewer results are returned.

My understanding from this previous support ticket is that this can be done in the legacy editor:
https://toolset.com/forums/topic/and-logic-between-category-checkboxes/

But we've built an extensive site using blocks and having to rebuild our archive in the legacy editor and trying to recreate the block layout with shortcodes seems backward.

Is there any way to do this now using Toolset Blocks?

Our site is behind authentication, so we can't give you access, but you can see some screenshots below.

#2651349

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand, you have post type archive with custom search where you added the "Place Features" taxonomy as frontend filter that is displayed as checkboxes and you want that when user select more than one checkboxes option those checkboxes option should have "And" clause instead of "OR" - is that correct?

Please clarify and then I will setup a sandbox site in order to share the solution with you.

In addition to that - Could you please send me debug information that will help us to investigate your issue.
=> https://toolset.com/faq/provide-debug-information-faster-support/

#2652519

Yes, pretty much. The default, unfiltered view should show all the Places to Study (currently 44 entries). When a user checks the box to choose a Feature, they see fewer results, as expected. But when they choose a second Feature option, they see more results when they should see even fewer results. Every result should be tagged with both selected features.

As I said in the original post, I can make this work in the legacy editor, so I'm hoping there's a way to set it correctly in the blocks editor settings.

#2652599

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The "And" or "OR" clause selection available with legacy view is for multiple custom fields. So for example if you have custom field A and B and you added custom fields A and B as frontend filter. You can set how both custom field should work with "And" or "Or" clause.

But as I understand you have checkboxes taxonomy or custom field where you want to have "AND" clause when user select multiple checkbox options. is this is true. (please clarify if its not true)

Can you please share problem URL and admin access details and let me see what workaround I can offer to you.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2654369

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URL of the page where you added the view and filters?

As when I checked the archive listing page of Tooset:
- hidden link

I do not see any archive added there. Can you please setup your desired archive with filters and send me problem URL.

#2657347

Never mind, it's not going to be possible for us to set up a testing site that you can access, or to get the details we need from your team. We've gone ahead and used the legacy editor but we hope that the Block editing interface becomes better supported that this isn't necessary in the future.