Skip Navigation

[Resolved] I need help sorting by distance from user-entered location only if entered

This support ticket is created 3 years, 5 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 3 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1855909

Tell us what you are trying to do?
I have a custom search/filter view set up for locations and providers. I need to filter posts by distance from the user's entered value if the user enters a value. Right now, when a user enters a location value, the posts get sorted alphabetically.

Is there any documentation that you are following?
No.

Is there a similar example that we can see?
Not sure. I've read a bunch of examples but couldn't find a solution to my particular case.

What is the link to your site?
hidden link and hidden link

#1856343
distance-order.JPG

Hello,

In order to setup sorting by distance, it needs classic editor, for example:

1) Dashboard-> Toolset-> Settings-> General:
in section "Editing experience", enable option "Show both the legacy and Blocks interface and let me choose which to use for each item I build", refresh your browser

2) Dashboard-> Toolset-> Views
Create a post view, in section "Ordering", you sort the result by distance, see my screenshot distance-order.JPG

More help:
https://toolset.com/course-lesson/filtering-and-ordering-map-markers-by-distance/

#1857235

Hey Luo, thank you for your response. I think that what you suggested will work, but I only want to order by distance when an address is entered. Can I give you login access to the site and have you confirm how this could work?

#1857325

OK, please provide your website credentials, also point out the problem page URL and view URL, thanks

#1862219

Thanks for the details, I can login your website, will update here if find anything

#1862255

I have tried the URL you mentioned above:
hidden link

The distance filter does not work.

Please check these:
Dashboard-> Toolset-> Settings-> Maps
in section "Google Map API key", click button "Check API", I see below error message:
REQUEST_DENIED - This API project is not authorized to use this API.

For the question "I only want to order by distance when an address is entered".
There isn't such kind of built-in feature, "order by distance" setting will override all other orderby settings, and if you use "order by distance" setting, you will not setup other orderby setting, it is a limitation of Toolset Maps plugin, you can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Our developers will evaluate it.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.