[Closed] filter using two taxonimies in the same filter

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.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Related documentation:

This topic contains 3 replies, has 2 voices, and was last updated by  Christian Cox 2 months ago. The support staff assigned to this topic is Christian Cox.

Viewing 4 posts - 1 through 4 (of 4 total)
Author
Posts
#549564

Hi,
I am trying to filter a post type using two taxonomies in one filter. In this page - https://centrodimedicina.com/professionista/ - there is the full list of doctors working in an hospital, in which the first search field "Filtra per servizio" is filtering the doctors by service using the taxonomy "services-taxonomy" (for example "allergology", "cardiology" etc.).
The problem is that in this websites we had to use two taxonomies for the services: the cited "services-taxonomy" and "complex-services-taxonomy", used for those services that are including other services. For example the complex service "Medical Imaging" includes the standard service "Radiography", and I need to make available both terms to my users.

I can't use two filters because my users don't know if what they're looking for is a standard or a complex service, so I need to merge these two taxonomies in one filter.

How can I do that?

Thanks,
Nicola

#549587

Christian Cox
Forum moderator

Supporter languages: English (English )

Supporter Timezone: America/New_York (GMT-04:00)

I see what you mean, but combining terms from two separate taxonomies into a single filter isn't something you can accomplish out-of-the-box with Toolset. It would require a significant amount of custom code that changes the way our filtering system works, and I would not be able to provide that kind of support here in the forum. I may be able to recommend another approach, if you can help me understand how your site works.

1. Can you help me understand why you chose two separate taxonomies instead of a single, hierarchical taxonomy? Do multiple complex services include the same standard service? Why is this type of taxonomy structure inappropriate:
- Medical Imaging
--- Radiology
--- Nuclear Magnetic Resonance Imaging (MRI)
--- Computed Tomography (CT scan)
- Orthopedics
--- Joint resurfacing
--- Prosthetics
--- etc...

2. How would you expect to organize the terms in this filter that includes both taxonomies?

#550372

Hi Christian,
I answer to your questions:
1) We used two different taxonomies because it's not possible to build a hierarchy since some services are located under different complex services, for example "Dental radiology" goes under "Medical imaging" and "Dentistry".

2) If possible we'd like to have the list ordered this way:
A) Mixed alphabetic:
- Allergology (service)
- Cardiology (service)
- Echography (complex service)
- Gynecology (service)
...
If not possible it will be good also:
B) Separated alphabetic:
- Complex Services
- - Echography
- - Physiotheraphy
- - ...
- Services
- - Allergology
- - Cardiololgy
- - ...

If I can add one question, in the same page the filter has a "text input" field that should let users search doctors by name or specialty (this one is inserted with a custom field), anyway the search for specialty is not working as, when I add the "search text" field there isn't the option "title body and custom fields". Relevanssi pro is installed and this field is set to be searched. Could you help me on this also? Tell me if it's better for me to open a new thread.

Thank you,
Nicola

#550394

Christian Cox
Forum moderator

Supporter languages: English (English )

Supporter Timezone: America/New_York (GMT-04:00)

There's really no simple way to accomplish this with separate taxonomies. The only solution I can think of would be:
- Create a checkboxes or multiselect custom taxonomy term field for standard service terms. Use the checkboxes to assign each standard service to one or more complex services. Hard-code the names and values of all the complex services as options for the checkboxes field. The value of each option would need to match the complex service slug.
- Use a View to loop over the complex service terms and a nested View that finds all the simple service terms filtered by the complex service term custom field. Use these two nested Views to build a custom multiselect input out of these options, and place it in your Filter Controls.
- Hide the standard complex service taxonomy inputs and the standard simple service taxonomy inputs in the Filter Controls using CSS.
- Write custom JavaScript that updates the simple and complex service inputs as the user changes the selections in the custom multiselect field.
- Use custom JavaScript that updates the custom multiselect field to match the selections in the hidden simple and complex service fields when a page with search results is loaded.

This is a complex solution that requires a lot of custom code, as you can see. Each of the points above is complex enough for a separate ticket. Let me know if you have questions about this approach.

anyway the search for specialty is not working as, when I add the "search text" field there isn't the option "title body and custom fields"
Hi, this sounds like a problem I won't be able to address in one or two sentences, so it's best to open a separate ticket. Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘[Closed] filter using two taxonimies in the same filter’ is closed to new replies.

Known issues and their solutions

We document known issues and their solutions in Toolset erratas. Save time by checking there first and seeing if what you are facing is a known issue. This list is kept short. We do our best to resolve all known issues with every release of Toolset plugins.

Support Policy

Toolset staff will help you use the Toolset plugins correctly, provide any information you need, help troubleshoot problems and advice on best-practices.

Please make sure to issue only one topic per each support ticket.

For more information, read our full Customer Support Policy.

Need custom programming work for your site? Check out our certified partners.