Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hi there,
I'm currently designing a website for a client and that have requested a search form for the store locator on the home page. I was wondering if it is possible to have a search form on a different page to the store locator. It should be just the same as the one from the panel. It would just redirect to the store locator page a feed the locator with the entered address.
Would someone let me know if this is possible? or suggest some solution for me
Thanks in advanced
Justin
Comments
Comment #1
justinf111 CreditAttribution: justinf111 commentedComment #2
justinf111 CreditAttribution: justinf111 commentedComment #3
justinf111 CreditAttribution: justinf111 commentedI have got it so on all pages I have a search form that the user will enter in the post code. Then it stores that value as a cookie and it then retrieved on the store locator page although I'm unsure of how to submit the value so that the google map will update the location.
Please help as I need this working for a client asap
Thanks
Comment #4
michfuer CreditAttribution: michfuer commentedSeparating the Map and panel is going to be difficult. The panel requires a storeLocator.View to bind with and that view is generated in the google_store_locator.js on page load. Also dealing with events such as clicking a store in the panel would be unusual.
I think your method of grabbing the postal code from a search form is the easiest option. You could add the postal code to the location-search input using jQuery, something like:
$('.location-search input', '.google-store-locator-map-container').val(ZIP_CODE);
The user will still have to click inside the location-search element and hit enter to activate the map search. If you wanted to automate this you could send a flag variable along with the ZIP_CODE so you know they're coming from the search form, then trigger a submit on location-search once the map has fully loaded (again using the jQuery functions .load() and .trigger())
At the moment I don't think there's enough demand for this type of functionality to create an "out of the box" feature.
Comment #5
michaelhaberle CreditAttribution: michaelhaberle commentedNobody is asking for it? That's weird. It's a super common (and widely-used) feature :)
I've been working on getting it to function today.
So far it isn't going too well.
Here's my hacky code full of redundant ways to try to get it to submit:
So far it's just not working though.
Comment #6
swim CreditAttribution: swim commentedSorry for the late reply but you could achieve this functionality by extending Drupal.behaviors.googleStoreLocator.
Accepting a url argument of postcode & state. Simple example but can easily be adapted.
Comment #7
pepsimxm CreditAttribution: pepsimxm commentedHi michaelhaberle,
Did you ever figure out how to submit the form without pressing enter?
Currently on day 3 of trying to figure this one out :)
Thanks
Comment #8
srikanthgdk_drupal CreditAttribution: srikanthgdk_drupal commentedHi,
Even I am searching for the apt solution to get the location details from the URL which is submitted from other page having a textbox and submit button and should search the location in our store locator panel and should be marked in the map. As simple as the functionality should work as it is by getting the data from the URL.
And the location search box should work on submitting a button tried to trigger keyup event on button click but no use.
PLease help me on this.
Thanks,
Srikanth
Comment #9
Nancy_Goyal CreditAttribution: Nancy_Goyal commentedHi
I also need this feature to implement. I have tried this by jQuery but unable to submit the view form to get the desired results. Please help.