Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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 each location post type to a parent store 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.

share|improve this answer
    
Ok this sounds like an ideal solution. How do I go about assigning a location to a parent and also I cant see away to manage these within a different post type? Any tutorials or help on this? Thanks –  Robert Nov 12 '12 at 10:02
    
@Robert the posts table has a post_parent field you can use to store the ID on save_post. there is no UI for managing a post type within another, I had to create it using add_meta_box, a bit of javascript to manage fields, and the API to insert / update location posts. –  Milo Nov 12 '12 at 16:01
    
Ok thats great I will give this a shot and let you know how I get on. –  Robert Nov 12 '12 at 16:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.