I have three views, two of them are nested inside the first one. I'm trying to filter and display information based off of a hierarchical relationship as well as a relationship using Toolsets built-in functionality.
- 1st view (parent view):
Uses post type "Services".
It has the 2nd and 3rd view nested inside using conditions to display.
- 2nd view (child view):
Uses post type "Services", but as a built-in post type hierarchical relationship.
This view works as it should.
- 3rd view (child view):
Uses post type "Attorneys", and has a many-to-many relationship with the "Services" post type.
This view DOES NOT work as it should.
Link to a page where the issue can be seen: hidden link
What I expected to see when searching for a service:
All relevant services related to the search term, all services that don't have children, and all attorneys that are in a relationship with the services that were returned from the search.
Instead, I got:
When searching for a service, you'll see that it returns the relevant services in relation to the search term, as well as all the services that don't have any children services using the 2nd view. The attorneys view works correctly as far as showing a list of the attorneys, but the list of attorneys should only be the attorneys that are in a relationship with the service that was searched.
It is still set to display Services rather than Attorneys, Also the filter you need to add is a Post Relationship filter and then select the correct relationship.
I'm assuming you want to list out the respective lawyers for the particular service correct?
We have tested that view (services-no-children) and it works as it should on prod. The only view that's having issues is titled "Attorney-card-search-results".
We only want to show attorneys after something is searched. The only Attorneys that need to show when something is searched are the Attorneys that are related to the returned Service that was searched. Some of the attorneys are returned, but we want any attorney that is related to the services displayed in the search results to be displayed.
For example. If I search for "corporate" I get three main services listed, Corporate & Transactional, Government & Internal Investigations, and Administrative & Regulatory Investigations. I need all attorneys related to these three services and the subservices of Corporate & Transactional to be displayed at the bottom of the search. How would i go about this.
If you need the see the attorneys that are linked to the services, you can simply click into a service as they are displayed in the sidebar of the service's single page.
1.) Based on what I see you are filtering the Attorney Card Search Results view with the Services view search bar correct?
Somewhat... the search currently works as it should in terms of showing the service results relevant to the search term.
If a service has child services, it shows the main service UI. The background img, sub category (child service) etc.
If a service has no children, it shows the card UI underneath them. The title, excerpt, and "learn more" button.
If anything was searched, and it returns a service, the page layout should remain as it currently does, but now it should show a list of all the attorneys that are in a relationship with the returned service. The attorney img, name, call/email , etc
If nothing is searched, the "Attorney Card Search Result" view should remain hidden.
2.) However I'm not sure what related information should the Attorney Card Search Results view be displaying.
The "Attorney Card Search Results" view should only display the Attorneys that are related directly to the returned list of services that were searched for.
3.) Is it that it should display the attorney's that are related to the service that was searched for ?
If you search for a service and there is only one service result, it should display all Attorney's that are related to the returned service.
If you search for a service and there are multiple service results, it should display all Attorney's that are related to the returned service's.
Ok so we are able to filter based on the returned results.
Except here
"If you search for a service and there are multiple service results, it should display all Attorney's that are related to the returned service's."
This will only work if we are adding the view below each post. So each result will return their related attorney under it.
Currently what you have is a list of post and then you want to display the related attorneys to all those post at the bottom of the page.
However we are required to have the Attorneys display as the post is looping.
I've been reading up on the Toolset Relationship API documentation since we're going to have to custom build this. Everything I've tried so far with just getting the relationship data to display has failed. How do I write the query for the relationship data and display Attorneys related to a service?
When a search is made, we're trying to display all the posts that are related to the search term, then underneath that it will show a list of all the attorney's related to those returned results.
Example:
Services
- Post 1
- Post 2
- Post 3
etc..
Your type of list cannot be generated since the Attorneys view is generating its related data by the current post that the parent view is listing.
The way you have it in your example would require that your attorneys view be its own individual view without a parent view. This is not possible since no parent post data will be passed into the view to determine which attorneys to list.