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!

Comments (10)

  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.

    • 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.

  2. 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.

  3. 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?

  4. 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!

  5. 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!

  6. Brigette says:

    I have a client that wants a doctors locator very similar to your store search plug-in. What would it cost to have you customize it for doctors? The list would include their name, title, address, phone, email and maybe a brief description of their specialty. I look forward to your prompt response. You do nice work!

  7. Harry Burton says:

    Website coming up soon – looking for such a plugin – Ron Z please come up with contact information for hiring

  8. Ray says:

    Great post. But is there a way for someone to search for a businesses without first importing those businesses’ address from a CSV file? For example, a plugin that allows a user on my site to type in a zip code and find, say, all the Chinese restaurants around that zip code?

    • Ron says:

      Hey Ray. If you have a restaurant database and want users to search by cuisine type, you would need to categorize the entries by type. Then a user can search by zip and filter by type. Is that what you had in mind?

Leave a Reply