bjorn2404 / jQuery-Store-Locator-Plugin

A store locator plugin using Google Maps API version 3
MIT License
495 stars 235 forks source link

Allow raw data #22

Closed michaelcurry closed 9 years ago

michaelcurry commented 10 years ago

dataLocation is great, but what about giving the ability to use the json string?

data: '{json, string, here}'
bjorn2404 commented 10 years ago

I don't understand why you wouldn't want to separate the location data. You can use a URL for the dataLocation setting if you want to use JSON.

michaelcurry commented 10 years ago

And that is what i did, but as it is only used in one view i had to make another controller method that is not protected by permissions to get the data.

Adding the ability to use a json string would allow for the display of this data without having a separation URI that is not protected.

MWDelaney commented 10 years ago

I would also find this useful. I want to build my locations from a WordPress custom post type, so I won't have a handy file to reference. Is this very difficult to add?

bjorn2404 commented 10 years ago

How many locations do you have? With WordPress you're going to want to take advantage of wp_localize_script, which allows you to pass PHP variables to JS. If you have less than 1,000 or so locations I'd recommend passing over the admin-ajax.php URL and using that (http://codex.wordpress.org/AJAX_in_Plugins). If you have several thousand locations you can save all the location data in a transient and pass that over in wp_localize_script. I am working on a WordPress version of this plugin but I don't have a timeline for release at the moment. I thought I'd be able to release it this summer but I work full-time and it's difficult to estimate. Also have to wrap up the new version of the jQuery plugin - if you know what you're doing you can test the development branch.

MWDelaney commented 10 years ago

I actually worked around the issue by creating a new XML feed in WordPress in the format this plugin needed. I'm happy to share the work if it would be helpful to you!

MWDelaney commented 10 years ago

I also have the sketch of a WordPress plugin that uses a custom post type for locations. It required Advanced Custom Fields for WordPress right now, but could be adapted to use custom meta boxes. Again, I would be happy to contribute this back.

The big things I'm missing right now are colored pins per location category (I'm hard-coding this for now) and more sorting options.

bjorn2404 commented 10 years ago

What I have set up so far allows you to select meta fields, ACF or otherwise, and map them in the settings. If you want to share it would definitely be interesting to see how someone else would approach it but note that I am planning on charging for the WP version (keeping jQuery version open source).

I do have new live filtering options in the upcoming jQuery version update on the development branch.

bjorn2404 commented 9 years ago

Finally got around to adding this. It's in v2.0.6 with the dataRaw option.

michaelcurry commented 9 years ago

:+1: