I have followed the following Google developer doc about creating a store locator usng PHP & MySql.
https://developers.google.com/maps/articles/phpsqlsearch_v3
I have this working but now I would like to integrate this with an existing WordPress installation.
My problem with integrating this, is the way WP stores repeatable custom fields. I have a repeatable field to enter multiple markers per custom post type. WP stores this as serialised data within the DB.
I cannot see a way of using the Haversine formula select statement mentioned in the doc to perform the radius search based on an entered postcode. I know there are various Google Map plugins out there, but I can’t find any that will:
- Add multiple markers per custom post
- Provide a search to list markers within a radius of an entered
postcode
Has anyone got any suggestions how I can do this, or does these features exist?
Thanks in advance for any help on this.
I implemented a similar custom store locator for a client, and what I ended up doing was saving each lat / lon pair as post meta for a single
location
post type, and then assigning eachlocation
post type to a parentstore
post type. that way, a single store could have multiple unique locations. location posts were hidden in admin and managed via a custom meta box within the store post type.