Skip Navigation

[Resolved] Toolset Maps distance filter does not work with pagination

This support ticket is created 6 years, 2 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.

Our next available supporter will start replying to tickets in about 1.30 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by Christian Cox 6 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1096380

I am trying to create a view that uses the Toolset Maps distance filter for users to find opportunities close to their search location. Whenever the maps distance filter is added, it makes it so that the view results will never display pagination. I can set it to show all results and it works fine, but pagination controls will never show up. Even when the filter is not actively being used, just having it added to the view makes it so that no pagination shows.

In addition, I would really like to be able to sort results by the distance from the searched location to the opportunity location so that closest items appear at the top of the list. It is my understanding that there is no way to do this through Maps and Views, is this correct? Is there a solution that you would most highly recommend to get this working?

hidden link
demo, letmein

I expected to see pagination working in conjunction with distance filtering and an option to sort results by distance from the searched location.

Thanks!

#1096397

Whenever the maps distance filter is added, it makes it so that the view results will never display pagination
You can see a map with distance filter and paginated results on my test site here: https://christiancox-22119-rel-1.discover-wp.com/map-search/?wpv_view_count=934&toolset_maps_distance_radius=500&toolset_maps_distance_unit=km&toolset_maps_distance_center=
There must be something else going on. Can you show me how the pagination shortcodes are added? There is an HTTP authentication shown on the site URL you shared, so I would need those credentials. I will activate private reply fields here so you can share in confidence.

In addition, I would really like to be able to sort results by the distance from the searched location to the opportunity location so that closest items appear at the top of the list.
We've recently added some distance sorting options, including sort by distance from a fixed location and sort by distance from the current User's geolocation. Check out our documentation here for some examples showing how you can order Views by distance: https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/#ordering-views-by-distance

#1097903
Screen Shot 2018-09-02 at 11.07.02 AM.png

Oh thanks, I overlooked the HTTP auth in your previous post.

For ordering by location, I do not have the option "as a distance from" when I choose an address field (Affiliate Location) to order by
Can you clear your browser cache and refresh the page? I have noticed this option does not always appear immediately when the address field is selected, but then appears when the page is refreshed. It seems to be showing for me now, I am attaching a screenshot here. When I select a fixed location, pagination appears in the View results as expected.

I also would like to order by the distance from the input in the views location filter, not by a fixed location or by geolocation. Is that possible?
At this time the only options are fixed location and User geolocation, but if you'd like to request this feature you can submit a new ticket in the forum using the "suggest an improvement" option. Our developers consider these votes for requests when deciding new features to implement.

#1099683

Thanks it appears to be working mostly as expected with pagination and sorting by a fixed location. I REALLY need this to sort by proximity to the searched location, and I could use some pointers as to how to accomplish this. Is there a hook I can use to add another option to that dropdown or a hook where I can pass the searched value to the query for sorting?

#1099730

I don't have any advice for modifying the distance calculation source, since that feature is neither built-in to Views nor supported here in the forums. There is currently no JavaScript API for manipulating filters on the front-end of the site, but we offer these PHP APIs for manipulating Views filter markup:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_start_filter_form
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_end_filter_form

We offer these PHP APIs for manipulating queries and result sets on the backend:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query_post_process