05.06.2012

Pazey’s Store Locator

Here’s a nifty plugin that I started working on last week. It’s my version of a Store Locator plugin that incorporates Google Maps. I didn’t know what to call it so I just used my son’s favorite imaginary character’s name ‘Pazzey’. I might add some more features in the future but here’s the stuff it can do:

  • Adds a custom post type called Stores for input of store locations
  • Automatically retrieves Google Maps coordinates of location
  • Lets you add a store locator in any page/post using a shortcode
  • Search by entering city and state/province, zip/postal code or part of an address
  • Shows results on right ordered by distance

Of course, here’s a demo showing a couple of record stores within the greater Vancouver area (perfect for Record Store Day store hopping!).

For the demo, type in any British Columbia city  - i.e. Richmond, BC or Burnaby,BC, press Search and let it show you all the stores within the radius you choose.

Live Store Locator Demo

Installation

Download and unzip the file below
Upload the pazzey_store_locator folder in your WordPress plugins folder
Log in to WordPress and go to Plugins
Click on the Activate link for Pazzey’s Store locator and you’re good to go!

Usage

Use the new post type ‘Stores’ to enter the information about your store locations. Don’t worry about the Google Maps Coordinates section since it will automatically populate once you save.

To embed the Store Locator, just type in storelocator enclosed in [ ] in your post or page.


You can also customize the look by editing style.css in the files subfolder of the plugin.

Download

You can download the plugin at WordPress.org

 

42 thoughts on “Google Maps Store Locator

    • I haven’t set up the shortcode to do that so it’s a feature that I can add to the next version. If you have any other suggestions of other features just let me know!

  1. Hello,

    The plugin does not work for me, neither does your demo. When I enter a search, it just keeps popping up with “Richmond, BC” please enter a location. And the map doesn’t change.

    • Hi Victor,
      Hmm, it seems to work on my computer. Can you tell me what browser you were using? I haven’t fully checked it in all browsers (but it works on Chrome, Firefox and the latest IE for me). Have you also tried clearing your browser’s cache? (it might help)

  2. Three things:
    1) I second what Mike said about having the map load up with the stores without having to do a search. I can probably create a google map that does that, but I really like the stores being listed on the side of the map.
    2) When I try to use the direction feature, the address is loaded with html break code between the address, city, state and zip. As a result, the google site doesn’t produce directions.
    3) I would like to load this on a mobilize web site. Is there any known issue (other than making sure the map is not too large)?

    Thanks for the good work.

    • Thanks for the great suggestions – I’ll try to check issue #2 and apply a fix and will probably add the the feature to load of the stores to the next version. I haven’t fully tested it on mobile devices but if you do encounter any issues, let me know so I can fix it in the next version.

      • Thanks, Cris – I am having the same issue as Steve:

        #2) When I try to use the direction feature, the address is loaded with html break code between the address, city, state and zip. As a result, the google site doesn’t produce directions.

        I hope it’s an easy fix on your side and you’re able to release the updated version soon! I want to keep using your plug in, but I may have to switch to another since my client wants me to fix that problem asap.

        Our site is: http://www.guitarfishmusic.com/store-locations/

        Type in zip code: 97224

        THANK YOU!!!!

      • Any other tips to get this to work? It won’t seem to accept my CSV as valid, but let’s assume I figure that out on my own…

        Once I’ve uploaded a CSV, how will the store locator know to connect to that to the search?

        Should I name each column “Store”, “Address”, “Postal Code”, etc?

        • Once you upload the CSV, it should auto populate the Stores custom post. So you should see all your stores added when you click on Stores in the admin panel.

          I did get some feedback that this might not update the latitude/longitude for Google Maps so you might need to go and edit each entry and click on ‘Update’.

          If you want, you can try to check if there is a service that will automatically give you a lat/lng for Google Maps if you send them a spreadsheet of addresses. This way, you can just upload your CSV file with the latitude and longitude information so you don’t need to update each entry.

  3. Great plugin!

    Some small tweaks:

    in storelocator.php:
    change form tag into:
    ‘+
    ” +
    ”+

    This adds “saddr” to google maps (addres “A”).
    Don’t forget to add:
    var address2 = document.getElementById(“addressInput”).value;
    to define the var.

    in xmlmap.php
    change:
    $earth_radius = 6371.00
    for “km” instead of “miles” (for our European friends)

    To remove the , for now I just removed the in xmlmap.php, there should be a way to strip the html in a way, but to late now :)

  4. Hello,

    Great work. Is it possible to change the name of the custom content type from “Stores” to something else? For example, if the module was used for church locations, could it be changed to “Churches” without breaking the plugin?

    Thank you

  5. I have installed the store locator – I have an existing listing list in excel of over 800 locations. Is it possible to import the locations from excel to the database?
    Please advise, Thanks Natalie

  6. I’d like to “third” requests 1 and 2 from Steve above. Looks like this will be be a capable plugin when those issues are resolved.

    Also, when a search returns only 1 result, the map is “zoomed in” so close that it appears the map data did not load. Is there a way to set a default zoom level?

    Waiting anxiously for the fix to the directions (embedded html) bug..

    • Hi Adam – sorry it took so long but I have updated the plugin fixing the HTML issue. So you can just download the lates version of it.

      As for setting a default zoom level, that’s one of the things I’m working on right now so you can expect to have that in the next version which I’ll try to upload in the next few weeks.

  7. Is there a way to use a category or tag to distinquish between types of stores? Then the stores displayed could be filtered by category or tag.

  8. So… I’m working on implementing a store locator with about 6000 stores… Needless to say, I’m taking the CSV import approach.

    I have it working *almost* perfectly… I say “almost” because, although my (sample set of five) stores are imported properly, and they all view in the Admin list of stores, and each store shows the correct information in the Store Editor… no store will actually *appear* in the website search until I’ve hit “update” on each store (apparently causing the Google lat/lon to calculate and populate.

    Obviously, I’d like to not have to go into 6000 stores manually, and hit “update” each time… Any thoughts? (I don’t have the lat/lon in my store database, fyi.. otherwise, maybe I’d try and populate that in the CSV…)

    Thanks for any advice!

    Chris

    • So, just an update: I did some more research and found a bulk-geocoding solution, and fed my addresses into it and got back lat/lon info… plugged that into the .CSV, and it works fine; stores are there right after upload, no need to “update” each one.

      Did find some interesting size limits (I’m on GoDaddy, shared hosting) when it came to uploading the 6000-line CSV… had to break that up into some chunks to avoid PHP timeouts (and that was after raising my limits….)

      But, all’s well, and I now have 6000 stores in our database.

      Great plugin – thanks!

      • Glad to know it all worked out. Got a bit busy with other projects (gotta feed the family!) so I wasn’t able to check back as often.
        Right now, I’m working on additions to the features so check back soon :)

    • I am importing a CSV file of stores, having to update each store individually (for the map to actually appear) is drag or maybe even a showstopper. Prefer not to do the bulk geo-coder step for lats/longs. Would be nice to have a bulk “updater” for all stores within your plugin. Any timeline on an update of the plugin?

  9. Hello,

    I really like your plugin but is there a way to make the map be a local city to start at instead of showing the whole united states?

    Thanks for any help.

    Terry

    • Hi Terry,
      I’m still working on this feature (a lot of people have been suggesting it) so you can check back in a week or two when I upload the latest version.
      Cris

  10. When I type in a zip code that has no matches, the map viewer centers on a spot in the middle of the Pacific Ocean. Is it possible for the map to center on the zip code that was being searched and still return the “No matches Found” result?

    Great work though!

    • Thanks for the input Robbie! I’m working on a newer version of this plugin right now so I’ll definitely make that change in the next release.

  11. Hi Chris
    This is a great plugin, i like it very much!
    Ideas for improvement:
    1. Localization of all the text (placeholders, button text and error messages) – I’m from Denmark so it would be nice to make it work cross languages.

    2. Can you do anything so that you can search for the postal code OR country only? I just can’t seem to figure out how to search for the postal codes, it just returns “no matches found”.

    • Thanks for the suggestions Danni! I’m working on adding a few more features for the plugin so I’ll try to see if I can work the localization in (I’ll probably need your help if ever to get a Danish translation).
      As for limiting the search to postal code or country – that’s another feature to add too.
      There’s a lot of suggestions for plugin and I’ll try to get as much in, so if I don’t get yours through in the next version – I’ll definitely have it added on later versions.

  12. Hi.

    Great plug in, and nice and small. Great for developers as the code is nice and concise.

    One problem i found was that when it is installed on a wordpress site where the installation is not in the root folder (as can be the default with softaculous installations for example), the iframe produces a copy of the website with a 404 error.

    On line 437 of store_locator.php, replace ‘get_bloginfo(‘url’)’ with get_bloginfo(‘wpurl’) to point the iframe to store locator file based on installation directory, and not the website url.

  13. is it possible to add a link from the search results to the store page… so that i can link to more information for each store?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 5683 bytes) in /home/crispuno/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_wp.class.php on line 666