Skip Navigation

[Resolved] distance filter for post with latitude and longitude custom fields

This support ticket is created 4 years, 4 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 – 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: Africa/Casablanca (GMT+01:00)

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 4 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#1721865

hey jamal so far all looking good i think this ticket will need separating but with your knowledge of my system i though be easier if i asked yourself
to help me sort through venues i decided to build my venue page that used a map and icon and a list of ALL venues including there addresses , this worked perfect and i can see all venues that need attention to the lat long.

i may as well finish this view off now.
list of venues here
front end here hidden link
the wp page hidden link
toolset view hidden link

3 issues to resolve (before returning to previous issue) i attach image to explain also
1: as the markers are from the events calendar data , how can set up my search filter for distance ?
2: when this filter functions how can i make it so the list under the map filters too.
3. in the search box , cn i have this ajax , so when typing it auto filters rather than having to type and press enter.

many thanks jamal

#1721913

Hello Martin,

Because the location data on venues is not managed by Toolset Maps, it can't be filtered by Toolset Views. Toolset Maps plugin uses an additional table(wp_toolset_maps_address_cache) on the database that have geo features enabled. The distance calculation is performed by the database.

To be able to perform geolocation filtering on a custom post type, the location needs to be added in a Toolset custom field of type "Adress". You can save latitude and longitude in a specific Syntax in the Address Custom Field. The Syntax has to be:
{lat,long}
Example:
{37.56731737931802,126.98020079790035}

For question (2), the filtering will always affect both the results and the map.

For question (3), AJAX can be enabled on the view's search, so you don't need to use the submit button. But it does not filter the data on the browser, it actually sends a new request to the server and receives the new data.

I hope this helps. Let me know if you have any question.

#1722677

1 so i cannot filter the distance on this map full stop ?

2 ok

3 (on organiser page) i enter the text search but it not ajax i have to press enter to do the search.(it has no submit button)

#1723037

1) Based on how currently location data is saved for venues, you cannot filter by distance on this map, full stop.
If the location data is not managed by Toolset, you cannot use the distance filter.

3) I checked with our 2nd about AJAX and the search box and he confirmed that we do not support this use case yet. The AJAX search will not be triggered from the search box unless we hit enter or we click on the submit button. That was my mistake, my apologies for it.