Do you have a search by postcode system available in the Google maps module? I see that a user can filter by distance from them or from a point of interest but I don't see anything about searching by postcode and the displaying custom posts on a map that are a certain distance from that postcode. Is this possible?
Regards,
David
Hi David,
Thank you for waiting while I did some more research.
You'll find a useful code snippet and instructions on how you can extract the postcode information from the Google Maps response when a location address is saved.
https://toolset.com/forums/topic/separating-content-from-the-address-field/#post-522506
Once, you'll have the postcode value saved as a custom field value separately, you'll be able to use it for filtering results, same as other fields.
Note: for distance based calculations through, you'll still use the location field and not the new postcode field, as it will be just a numerical value.
I hope this helps.
regards
Waqar
Hi Waqar,
The post code will already be part of the custom post as its own custom field so no need to extract it. My question is, is it possible to have a user search by post code for these custom posts using the filter by distance from that post code.
Regards,
David
Hi David,
Thanks for clarifying that.
The filter by distance feature would work only from a location field (i.e. a point on the map) and not from a postcode.
A workaround can be to add a location field for each postcode and save a location on the map which lies roughly at the center of that postcode area.
That field can then be used for distance-based filters/comparisons.
regards,
Waqar
Hi David...wondering how you resolved this? I'm trying to do the exact same thing you were asking about. Did you find a solution that works? Thanks!
Hi David...wondering how you resolved this? I'm trying to do the exact same thing you were asking about. Did you find a solution that works? Thanks!