Skip Navigation

[Resolved] Displaying parent and child in a search view

This support ticket is created 7 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 4 replies, has 2 voices.

Last updated by Luo Yang 7 years ago.

Assisted by: Luo Yang.

Author
Posts
#579171

I do not come across the following problem:

I have a costom post type: companies.
For this post type there are post fields, for example: Google maps, phone, www. and the: ADDRES field.

But some companies have more than one ADDRESS.

So i made a one-to-many relatonship which the same post addres fields.

Now it's coming:

I have a search view that filters on two things: taxonomy: industry and a costom post type: province

The view shows the results on a map. When I go to the page with the view, i see all results (id = "$ companies) displayd correct.

Only when I start filtering by branch on taxonomy the one-to-many childs ADDRES wil no longer be displayed on the map. But i need these locations also on the map.

#579176

It seems that only custom field province (filter) works.

So the taxonomy filter : industry don't shows in full on the map. Only one location, but not the one-to-many extra location(s) of the (custom post) company.

#579276

Dear arnoldd,

I assume we are talking about this case:
Grand-parent post type: province
-- Parent post type: companies, with taxonomy "industry"
----- Child post type: ADDRESS, with custom fields "Google maps, phone, www"

I suggest you setup a nested view:
1) Parent view query only one post type "companies":
a) filter by taxonomy "industry" and parent post "province"
b) display "companies" post information + below child view

2) Child view query ADDRESS posts, filter by parent post setup by parent view, filter by:
Post relationship filter
Select posts that are a children of the current post in the loop.
and display the google map markers

More help:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

#579393

Dear Luo,

It seems to work.

Only i get the error on the bottom of the map: no items found.

So i removed from te nested view:

[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]

Is thiscorrect?

#579738

Yes, if you see the message:
No items found
That means there isn't any child "ADDRESS" belongs to current "companies" post

If you remove those codes from child view, then it will not display that message.