Skip Navigation

[Resolved] Search by fields in relationship

This support ticket is created 3 years, 9 months 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by chrisL-13 3 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1981185

>> Tell us what you are trying to do?

I am trying to build a page that allows visitors to show a list of projects that the company has completed that are part of a certain sector or that have used a certain service that the company provides.

In Toolset terms, I have the following:
* 'Clients' and 'Services' are custom content types.
* 'Projects' are a content type created by a many-to-many relationship between 'Clients' and 'Services'
* The 'Client' content type has a taxonomy 'Sectors' which describes what area of the economy/society the client is involved with (Manufacturing, Finance, the arts, etc etc)

I would like to offer site visitors a series of check boxes that allows them to see only projects whose client belongs to a certain sector or whose client used a particular service.

I cannot figure out which custom search filter field to set up. It looks like "Post relationship or repeatable field groups owner" but I can't make it work. I have not been able to find the Client -> Category or Project -> Related Service -> Service Title

>> Is there any documentation that you are following?
https://toolset.com/lesson-placement/lesson-placements-1622935-1621213/

>> Is there a similar example that we can see?
Not that I have found

What is the link to your site?
hidden link

It's behind a server-level authentication scheme: username: porpoise password: 12india9

#1981267

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Chris,

Thank you for getting in touch.

Based on the title of your thread it would appear you want to filter your posts based on a relationship custom field correct?

Are these fields on an intermediary post type? Also are these the only fields that you will be filtering by? The main reason is that you can only filter by the custom fields of the post that the view is currently displaying.

There is a workaround to this however I need to know if all the fields that you will be filtering for will be on one post type.

Thanks,
Shane

#1981285

Hi Shane,

"Clients" and "Services" are two content types that are in a many-to-many relationship. "Projects" is the resultant intermediary post type. The results view on my search page shows fields from the "Projects" intermediary post type.

I want to filter on "Sector", which is currently a taxonomy assigned to "Clients" and I want to filter on "Services", which is a post type that is half of the many-to-many relationship between clients and services.

The specification for this work only envisions filtering by 'Sector' and by 'Service'.

I may be able to restructure this if it makes sense, but "Services" have their own pages and "Clients" are in use in other parts of the site.

And the company I'm working for offers many services to many clients and it's the clients are involved in many sectors, so there's a logic to the way things are set up.

cmkl

#1981359

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Chris,

If I understand correctly now, you have a view that is listing out Projects and you want to filter the Projects by Sector and Services.

While you are able to filter by Service through the Post relationship filter, you won't be able to filter by the Sector taxonomy. This is because the view can only be filtered by the attributes of the posts that it is listing.

The workaround would've involved nesting the Projects view into the Services view and then just create a search on Services, however you want to filter by attributes that are exclusive to both post types which won't possible to do.

Thanks,
Shane

#1981455

Too bad. But you make an interesting point. I didn't think it was possible to nest views.

Is it?

cmkl

#1982431

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Chris,

It is possible to nest the views when the view is built using the Classic editor. Currently with the Blocks editor it is not possible to do.

Thanks,
Shane

#1982433

Is there a guide on installing and using the classic editor?

#1982553

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Chris,

The classic editor is actually available with our Blocks plugin as well. In order to enable it you will need to go to Toolset -> Settings and scroll to Editing Experience and then enable the setting "Show both the legacy and Blocks interface and let me choose which to use for each item I build".

What this will do is allow you to use both the Block editor as well as the Classic editor. Once the page is saved you will need to refresh and you will now see the Legacy interface at Toolset->Views and from there you can create your view using the classic editor which will allow you to nest the views.

For further documentation on Nesting your view you can check out our Legacy documentation on this.
https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/

Please let me know if there are any further queries on this and I would be more than happy to clarify.

Thanks,
Shane

#1982561

My issue is resolved now. Thank you!