WordPress Location Search By Zip Code

Last week I completed a Worpress CMS conversion for a site that was running a custom Ruby on Rails CMS. Everything was pretty straightforward, only caveat was that they wanted to be able to search their 12K+ locations by zip code, paginate the results, and also display them as markers on a Google map.

Here’s the end result: http://eudgets.com/corazonas/store-locator/

If no locations show up in your zip code, try using 90049 to test it out.

The plugin uses some pretty straightforward admin functionality:

Ability to upload a CSV file of the locations which is stored in a separate table. The budget didn’t allow much room for editing/viewing entries directly from the admin area, so in order to add/edit entries, the admin needs to re-upload a new CSV file…overwriting the contents of the database.

CSV Upload

Ability to download the CSV file:

The Javascript is handled by Prototype and the code is based on a watered down query I use over at PlanJam.com. Considering the number of locations being searched and having to plot the results on a map…it’s pretty quick!

Tags: , , ,

6 Responses to “WordPress Location Search By Zip Code”

  1. Is this a plugin you’ve created? Is it available in the repository or for sale? Looks exactly like something I need for a client at the moment.

  2. Ron Z says:

    Hey Kevin,

    It’s something I coded from scratch, using a DB of zip codes that are stored locally, and not available for the public at the moment. However, I am always available for hire and would be happy to code up something similar. Shoot me over a message and let me know what you’re looking to accomplish.

  3. cyberhobo says:

    Hey Ron – just so you know, Geo Mashup now automatically geocodes and stores ZIP for all locations (where it is available from Google’s geocoder, at least). With a little custom code you can query and map posts in a ZIP.

  4. Ron Z says:

    Thanks Dylan! I was actually considering that option but the client wanted the ability to manage the content through a CSV file. BTW, not using Google to geocode…instead, there’s a US zip code database. Also, 12K posts (and growing) might have been a bit unmanageable, especially when they need to add/remove chain stores such as Target or Costco.

    Out of curiosity, how do you think the plugin would’ve performed with that many posts?

  5. Jack says:

    Great plugin! I recently quoted a client for something very similar. They didn’t bite (apparently they thought this stuff was free), but it was still a fun thought exercise!

  6. Steve Hansen says:

    Very nice. Like the site. I am new at wordpress. Looking for a free database plugin to start playing with. Anyone know where there is a free one I can use, and one that might interact with google maps? Thanks!

Leave a Reply