bjorn2404 / jQuery-Store-Locator-Plugin

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

Form submission #116

Closed Redani closed 8 years ago

Redani commented 8 years ago

Hej Bjorn, hope you're doing well and thanks for this new update which is really full and packed of options and callbacks functions :)

I'm trying to implement it but i'm facing a little small problem: in all your example you always submit the variables 'origLat', 'origLng' and 'origAddress'. In my case I will not need these 3 variables but rather a custom ones that i include in the form: 'zip' and 'country'. And I don't really need to use the geocode function.

I had to tweak your code by replace this: data: { 'origLat' : lat, 'origLng' : lng, 'origAddress': address } with data: $("#bh-sl-user-location").serialize()

But i was wondering if it's possible to do so without altering your code.

Thanks a lot and have a great sunday

bjorn2404 commented 8 years ago

I don't have a way for passing custom things at this point so you'd want to add what you need in that AJAX call. However, you could use the origLat/origLng coordinates and do a reverse geocode on them to get the information that you need instead of trying to pass it over.

Redani commented 8 years ago

Thanks for your reply! Actually I can not use origLat/origLng because only the zip code is required to retrieve the locations... :(

1- is it possible to deactivate the generation of origLat/origLng? maybe the plugin will run a little faster?

2- I'm displaying the map in an overlay with another form to search again by zip code. As you are using ID for the form and the input search, I think I must have another form with other IDs ("bh-sl-user-location2" and "bh-sl-address2") and of course changing "formID" and "addressID". I'm currently struggling to run 2 instances of store locator. How can I do that? or what is the best way to have 2 search forms ?

3- for better styling the map, I have set the locations list as absolute position. When I click on the list, the infowindow is kindda centered in the map, but when i click on a marker which is near the list, the infowindow is hidden and doens't center... :( (attached image) is there a fix for this?

Thanks a lot Cheers

screen shot 2016-05-31 at 10 49 31
bjorn2404 commented 8 years ago
  1. It is not possible to deactivate origLat/origLng
  2. The plugin is not set up to be able to run more than once on the same page
  3. Don't use absolute positioning if having the list over the map is going to be a concern
Redani commented 8 years ago

Thanks for your reply.

2- so what would be the best way to have the search form in the main page and also in the overlay? aside from playing around with $("#source").prependTo("#destination");

3- also, i'm trying to understand why the infowindow works perfectly when i click on the left list, but not when i click on a marker :/ any idea?

4- and one last question plz, don't know if it's a bug or not: when the input field (bh-sl-address) is pre-filled, it automatically submit the form and shows the map, how can I prevent this from happening? I tried slideMap: false but didn't work :/

Thanks

bjorn2404 commented 8 years ago

How are you pre-filling in the input field? Maybe use a placeholder instead?

Redani commented 8 years ago

I'm pre-filling the inout using value="<?php echo $value; ?>" The main purpose of doing what i want is that i'd like to save the users location in a session variable in order to prefill the search field in case he wants the change the location. Placeholder could be a solution, but what if the user enters for example for the first time "Edine, MN", than wants to correct it into "Edina, MN", the user will have to write it all in stead of just correcting it :/

I for now fixed it by using data-value="" and some jquery. but hope there will be a native solotion...