I'm a little lost of where to start. I have a listing archive page set up (called providers). I have added some filtering options (keyword search and taxonomy "specialty"). I want to be able to add a location filter where a user can input an address on the front end to sort the results. I don't even want the map showing, just want the results to filter. I've purchased the maps plugin.
I'm having a hard time finding the documentation to set this up; I'm not a programmer but I'm able to implement things when I find clear direction.
This is what I'm working with so far:
enlace oculto
I tried following this thread by creating the custom field "types-address" and inserted the JS but I'm not sure how to make it all work together:
https://toolset.com/forums/topic/output-location-field/
I think this should help:
https://toolset.com/documentation/user-guides/display-on-google-maps/filtering-and-ordering-map-markers-by-distance/
You can forget about the map itself if you do not need one, also the marker is not required.
The important for you here is the Query (Search) and order options, as you can find it in the above linked DOC in the 2nd and 3rd section.
It's recommended to have a HTTPS site, set up posts with the Custom Address Field and save some addresses
For this you will need a valid Google API Key:
https://toolset.com/documentation/user-guides/display-on-google-maps/creating-a-google-maps-api-key/
Then you will be able to create Views, or Archives, and add Ordering and Search Filters by that address (also by current user location and distances from).
Note that the thread you followed is from 2016, back then the Toolset Maps Plugin did not exist, it was a (different) plugin incorporated in Toolsets Views.
Today - on new sites, you should use this instead:
https://toolset.com/documentation/user-guides/display-on-google-maps/
Please let me know if anything remains unclear, or if I can help with some example 🙂
If an example is required, I'd need access to a testing site where I can show you.
I enabled a private reply for you to provide such access if that's required
This is the archive you are working on right now, correct?
enlace oculto
However as mentioned - for addresses you should use the Address field.
https://toolset.com/documentation/user-guides/display-on-google-maps/filtering-and-ordering-map-markers-by-distance/
Right now, you have a Multiple Line field that cannot create proximity searches or other address related queries.
So you need a field of type "Address".
Then, you can populate some posts with that address field and in the Archive, in the Search and Pagination filters section you can then add new searches by it, or even by location proximity.
But first, you need the address field.
Definitely was missing that step thank you for your awesomeness. I've added the address custom field correctly now and I've populated some of my posts with some content. Yes, that is the archive I am using.
On the archive settings under search a pagination, this is where I get confused. I added a new filter and selected the address type field group. Then I added the distance value from forms and views. I'm unsure of which settings to use for the distance value. Maybe it's not working because my ssl isn't ready quite yet? I didn't want to search by geolocation but for the user to manually enter their address to center the search radius. So I used URL parameter?
My screens don't match your reference doc so I'm sorry for my confusion. Again grateful for your wizardry.
I still see a few issues with the address field.
When you head to any of the Providers and edit, you'll see "We could not connect to the Google Maps autocomplete service, but you can add an address manually."
Something's wrong with the API Key I suspect.
When I use my own key it works fine, so I suggest to review the API Key you created for this, using this DOC and Google's related documentation:
https://toolset.com/documentation/user-guides/display-on-google-maps/creating-a-google-maps-api-key/
Then, that issue should be gone and you'll have a fully functional, address field.
Without that your addresses will not match what Google expects (they have a highly complex syntax for addresses that is usually automatically produced for you when adding the address.)
Once that's out of the way, saving addresses will then enable you to query by those in a View listing the Providers, or in an archive.
There you have some choices (after deleting both Query filter and Search and Pagination filters from that archive you have now):
- distance from (requires SSL for current users locations)
- address as a string pickable from available ones or else input type
As of now it doesn't work because the address does not save properly.
Also note, that you cannot load twice a Maps API and I believe Divi offers one too. So you'd have to turn that one off if that's possible, or turn Toolset Maps off and use Divi's map instead.
Currently your Divi is loading the maps scripts, in enlace oculto, so that will conflict with Toolset Maps Google maps scripts.
Either of both would need to be removed.
I think after these steps not only the screens will match what you see on the doc, but you will also be able to see how to create the address filters.
If not, please let me know so I can eventually try creating a example on your site, if that's ok.
I finally figured it out!
API is fixed...I hadn't included the places when creating the api. Now the addresses are populating correctly for each provider post. I've also turned off the map script in Divi.
On my archive page, I figured out why I'm so confused. The "distance" filter like in the reference doc, isn't available on an archive page. I cleared the query and filters from the archive page like you said. I created a View and now I see the distance filter! I thought I was going crazy. It does not say on that reference doc that you have to create a view to implement the distance filter. In fact, I spent hours digging to find a document that clearly explains all the steps
enlace oculto
Anyway thanks for sticking through this with me...huge high fives for your support!
Well, this fooled myself.
Actually you where able to add Distance searches to archives, but Toolset removed that features, because it was actually not fully working.
I somehow missed this.
Archives do not support distance searches, only Views do. My deepest apologies for navigating you thru all this when a simple statement could have saved the time.
Note, you would maybe want to request the feature to be added (distance search in Archives) - that could be done at https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/.
Thank you again for your patience.