This support ticket is created 3 years, 11 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?
Get the closest results by lat/long
What is the link to your site? hidden link?
When you search by zip code or address (and select the result Google Provides in the drop down) the results properly filter by closest first. When you put in the lat/long the proper results come back but they are not sorted by closest first.
Example:
Search for 100 N. Edinburgh Dr., Suite 200, Winter Park, Florida 32792 (This will Work)
Now search for the location lat/long 28.59739858197293, -81.32525421568737 (This will return the location but the order is messed up)
Hello and thank you for contacting the Toolset support.
To better assist with this issue, I'll need to fully understand how you reproduce it. I wonder how do you search by lat/long? AFAIK, the location filter only accepts addresses, I do not think it accepts lat/long!
However, what sorting would you expect to get when searching for the lat/long 28.59739858197293, -81.32525421568737 ?
Would it be possible to allow us temporary access to the backend so we can check this view closely? Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
It seems that searching with the address and with the current position does not only return posts in a different order. It also returns different results:
- Searching for the address produces 103 results.
- Searching for the current position produces 18 results.
I tested with the provided address, the provided coordinates, and a radius of 20 miles.
As I am not familiar with your website and its data, I'll need to know what results would you expect for this search? How many results? And what post should be the first?
With these pieces of information, I can analyze the situation better and I might also need to take a copy of your website for further debugging. Let me know if that would be ok with you.
The results for both searches should be exactly the same. When you search for the address it is correct. Using the lat/long for the same exact address I would expect the results to be exactly the same (18 results). When I search for the address and use the google provided address I only get 18 results. Searching Lat/Long also only gives me 18 results: hidden link
Winter Park Orlando OBGYN – Edinburgh Drive should always be the first result because that is the location that matches both the address and the lat/long.
Please feel free to test locally if that will help. Thank You.
Unfortunately, I am not able to get 18 results when searching with the address. I was getting 103.
The theme archive template is using some custom PHP code and Javascript code to use the view "Find a location". The view also has a custom JS code to sync the address from the custom search input to the view's filter, which is hidden. I noticed in the browser console that sometimes the address is not sent within the search(no center provided).
To isolate the issue, I have switched the theme to 2020 and used a new view, in a private page, that does not hold any custom JS code. I was still getting the same results (18 with lat/long, 103 with the address).
I cleared the Toolset Maps cache and I am getting different results now(18 with lat/long, 99 with the address).
I am taking a copy of the website to further investigate this, and I'll get back to you.
Jamal is off. This is Minesh here and I'll take care of this ticket. Hope this is OK.
When I checked the Toolset Map's settings at:
=> Toolest => Settings => Maps tab
I see that you did not registered the correct google map API key. I've registered my test key that you should remove and please add correct unrestricted google map API key.
For now, I try to search with both Address (100 N. Edinburgh Dr., Suite 200, Winter Park, Florida 32792) and the lat/lon (28.59739858197293, -81.32525421568737) the first result at top is (Winter Park Orlando OBGYN – Edinburgh Drive).
Can you please confirm and do not forget to remove my google map test API key.