Skip Navigation

[Resolved] Filtering by relationships

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1605375
ToolsetQ.png

Greetings from Poland,

I am working on a web page of doctor availability for a chain of medical clinic.

Here is the Custom Post Type structure and the relationships between them:
1. 'Doctors' - doctor can works in many clinics. Relationship: Doctors [*] << Doctors - Clinics >> Clinics [*].
2. 'Clinic' - Each clinic sets its own working conditions like prices and payment types.
They have their own taxonomy: payment type .
Relationship: Clinics [*] << Clinics - Insurance >> Insurance [*].
Doctors [*] << Doctors - Clinics >> Clinics [*].
3. 'Insurance' - The clinic belongs to many the medical insurance network. Relationship: Clinics [*] << Clinics - Insurance >> Insurance [*]

We have our own reservation system with availability calendars.
The search results will be as in the attachment.

I am looking for a solution sa beelow.
If:
- The doctor does not set price and payment conditions, but inherits them from the clinic where he works;
- The doctor does not set with which medical insurer he cooperates, and he inherits it from the clinic;

Results:
- Search filters allow to find a doctor by accepted medical insurer and payment type;
- In loop view patient can change clinic where the doctor works (our calendar will also change, and the price list will also change, but we will do it in our reservation system)

(BTW: if you are looking for an extension for Toolset, then our reservation system is the best. I guarantee!
I will be happy to provide details and we can talk about cooperation).

Is there a similar example that we can see?
hidden link

What is the link to your site?
hidden link

Regards,
Robert

#1606679

Dear Robert,

Toolset Views is using WordPress class WP_Query to query posts, there is a limitation:
If you query posts of a post type, you can only filter the result by fields/taxonomies of current post type.

So in your case, you can consider nested view:
1) Parent post view:
- Query "Clinics" posts
- Filter by:
a) Post type relationship between "Clinics" and "Insurance"
b) taxonomy "payment type"
https://toolset.com/documentation/user-guides/views/front-page-filters/
- In view's loop, display below child post view

2) Child post view:
- Query "Doctors" posts
- Filter by:
a) Post type relationship between "Clinics" and "Doctors"
In view's loop, display below child post view

And the nested view does not support in Blocks Editor by default, I suggest you try with classic editor to setup the nested view.

Dashboard-> Toolset-> Settings-> General, in section "Editing experience", enable option "Show both the legacy and Blocks interface and let me choose which to use for each item I build".

Then you will be able to setup the post views with classic editor here: Dashboard-> Toolset-> Views