Skip Navigation

[Resolved] Split: Filter view by related CPT and display on map – distance filter shows empty results

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 21 replies, has 2 voices.

Last updated by Minesh 2 months, 3 weeks ago.

Assisted by: Minesh.

Author
Posts
#2777840

That's great. I didn't understand how the shortcodes worked inside the View Loop and interacted with the Map module outside it. This example really helps.

My next issue is the view is not displaying any results when entering an address in the distance filter. Can you look at my settings and tell me if I'm doing something wrong?

#2777844

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please tell me what address I should use that should display the results but currently its not displaying the results for that address using distance search?

#2777861

Try
3506 GA HWY 224, Montezuma, GA 31063
or
101 Lect Dr, Perry, GA 31069

There should be at least 2-4 locations visible on the map.

#2777931

I don't know what happened, but now the view doesn't display any results at all. I tried recreating the page but the Add Search Field option doesn't even let me access the Buildings fields.

#2777998

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see you added the post relationship filter and added the Query Filter for that

Filter by post relationship or repeatable fields group owner
Filter based on the frontend search filter selection.

But I also see you added the "Post parent" query filter as well. What if you remove that and check if that help you to see the posts.

#2778038

I removed the extra filters for now, but I added them for a reason. I don't think that's causing the issue. There is some weird behavior with the loop. It won't display the featured image from the buildings. It says "This dynamic source returned no content" even though when viewing the page it renders images. The image field was flashing every few seconds, disappearing and reappearing. It's not doing it anymore. Before that the shortcode for the map marker was flashing off and on.

Try adding a new search field. You'll notice that no Buildings fields are available. I want to add a filter for the user to limit the view by the Build Date field (one year or older) but it's no longer available in the dropdown. I tried the same thing on a new page (hidden link) that only has the view with a content selection of Buildings, but no buildings fields show in the search options. They did before because I added the category filter, which is still present on the first page and works.

#2778042

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see you are working and Take over the control.

Please let me know when you finish.

However - here is the Doc that shows information how you can display images using Toolset Blocks:
- https://toolset.com/course-lesson/displaying-images-with-toolset/

How you can build "Custom Search":
- https://toolset.com/course-lesson/creating-a-custom-search/
- https://toolset.com/course-lesson/displaying-a-list-of-posts-on-a-map/#display-a-map-with-a-search-and-a-list-of-posts-side-by-side

And how you build Distance Search:
- https://toolset.com/course-lesson/filtering-and-ordering-map-markers-by-distance/

#2778043

I closed everything a few minutes ago and haven't done anything on it since I last posted. You are free to check it out now.
I have also read all the documentation you posted above. Something is not working right and I can't tell if Toolset is bugging out or if I misconfigured something.

#2778044

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can we go step by step and tell me what exactly not working with your view on the following page:
- hidden link

When you say image was used to flash - but I did not modify anything with your page so I wonder how it was broken.

Maybe you can share few screenshot or video and tell me whats not working and what is your expected results.

#2778047

I'm trying to:
1. display a list of buildings from my buildings post type
2. show those buildings on a map according to the address in the related dealers post type (see map marker in view loop)
3. filter the buildings by category, distance and/or build date (only the category is currently working)

The problems are:
1. the buildings fields are not showing when I add a new search field (the entire buildings post type is unavailable in the dropdown but the dealers post type is available, which is strange because the view is set to buildings). I need the build date field so I can allow users to show only buildings with a build date of one year or older.
2. the map is not filtering the buildings by distance

#2778048

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've deleted the custom field cache from:
- Toolset => Settings => Front-end Content tab => Cache section

I can see now Building fields when I add a new search filter:
- hidden link

Can you please confirm.

#2778049

Yes, that worked. I tried that at least 2 times and it didn't work for me. Maybe it needs to be done 3 times 😉
Can you tell me why the distance filter is not working?

#2778160
Screenshot 2024-10-17 093914.png

Here is a screenshot of my settings for the filter field. I have the Address field selected but it doesn't seem to work. If you look in the comparison field there are 2 Address fields available there. I don't know why. There's only 1. I've tried both anyway but neither of them seem to work.

#2778305

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The thing is that, you can build the custom search view using the custom fields, taxonomy that belongs to post type you set your view to query.

So, for example, if you have post type A (parent) with custom fields (aa,bb,cc) and post type B (child) with custom fields (dd,ee,ff) in one-to-many relationship and if you build the view to query post type B (child) then it should apply search on fields belongs to post type B that is fields (dd,ee,ff).

In your case the Address field is belongs to parent post type Dealers and you set your view to query the post type Buildings. As you set your view to query post type "Buildings" you can add the custom search fields belongs to "Buildings" post type as "Address" field belongs to parent post type "Dealers".

However - even if I try to find workaround I would like to know how it should work.

I see you added custom field "Category" filter that belongs to Building post type, that is ok.

But then the Distance search field "Address" belongs to parent post type "Dealers" and you also added the multi select filter for post-relationship of "Dealers".

So, for instance when user input address string for distance search as well as user selects two options from multiselect "Dealer" post-relationship filter - how you wish it should work?

For instance, user input address string for distance search and that address has found 3 Dealer posts with IDs (21,22,23) and user also selected 2 Dealer options with IDs(22,25) from multiselect "Dealer" post-relationship search. It should display the result of Dealer IDs (21,22,23,25)?

#2778325

I removed the dealer filter altogether so we can focus on the distance filter. If I need the dealer filter later I can add it then, but for now I can simplify it to meet my goals.