[Resolved] Sort locations by distance between the searched location and the other locations
This support ticket is created 5 years, 7 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Tell us what you are trying to do?
Because the simplemap plug-in stopped working on our site we decided to rebuild this functionaliteit with the toolset maps plug-in. We got the most part working except the sorting of locations. When using the 'use my location' button the locations under the map are sorted correctly, but when we search a location like 'Rotterdam' first we get 'Ridderkerk' and then 'Rotterdam'.
What we would like to see?
When we search for a place the locations under the map needs te be sorted correctly based on the linear distance between the searched location and the other locations.
Example when we search for 'Rotterdam':
- Rotterdam
- Ridderkerk
- Vlaardingen
and so on.
When you edit your View you should see an option to order by the distance from the address field (see screenshot).
If you don't see the distance option there may be a caching issue on that page, perform a hard reload and it should appear.
However, the only options are to order by the distance to a fixed location, or the user's current location.
The option to order by the distance to a location specified in a search isn't available. It appears to have been an oversight, and I have submitted a request for this to be added.
Currently it just isn't possible, but I'll press for this to be added soon as it is an obvious use case.
This is something I have been back and forth with support with as well. It seems like a simple addition (makes more sense than sorting by a fixed location) and based on my searches, it seems as though many people could use it. Please add my vote to get this added as well!