Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
There is a Javascript warning being shown when the lib is loaded:
Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required
This parameter is not required and can be removed.
Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
Google API key needs to be added in the URL
Proposed resolution
- Removal of sensor parameter from API
- Addition of key parameter
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#8 | google_store_locator-javascript-warning-2776133-8.patch | 3.41 KB | rodrigoeg |
Comments
Comment #2
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedPatch attached
Comment #3
das-peter CreditAttribution: das-peter at Cando commentedLooks good to me. But how about tackling the warning
Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
at the same time?Attached patch:
gsl_google_api_key
which can hold the API key.google_store_locator_get_google_api_key()
- shamelessly copied from gmap module. The function returns the API key and integrates with the keys_api and keys module.Since the patch is still pretty readable, even with all the additions, I'm bold and sort of hijack this issue ;)
Comment #4
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedVery good additions, @das-peter.
I updated the title and summary of this issue to reflect these updates.
I noticed the Geocoder modules already have a field with Google API key. I am not sure if it would be better to use this other variable, since this module is a dependency of Google Store Locator:
Also, this new field of API key is required. If the user is using the module keys_api or keys, I think this field should not be required in this case, but I am not sure how other modules handle this integration. Maybe adding in the description of the field more information about this integration available with keys_api and keys modules will also help.
Comment #5
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedComment #6
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedChanging the priority because this module does not work without an API key anymore.
Comment #7
orkineo CreditAttribution: orkineo commentedHello Rodrigo,
Have you managed to run the link ave API for Google?
I have a site blocked for a month and if there is no chance to restore the system I have to put up another.
Thank you for your effort and your work!
Comment #8
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedRerolling the patch on the newest dev version of the module.
Also I have removed the integration with keys_api module. It seems this module was renamed to keys and now only the keys module exists. Since it is a new integration being added here, I think it is better to use only the new name of the module (for reference: #1899086: references to "keys_api" module?)
I have also added a verification in the configuration page (also based in gmap module) to hide the field and show some others instructions if keys module is enabled.
One more step was added for the module installation in README file to mention this API key configuration. Probably the documentation page of the module needs to be updated after a new version is released (I will try to remember of doing it).
Comment #9
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedHi @orkineo, try this latest patch to check if it resolves your issue.
Comment #10
orkineo CreditAttribution: orkineo commentedHello Rodrigo,
A big thank you for this work, the patch worked instantly.
It's a great module and community
Comment #11
AkiBro CreditAttribution: AkiBro commentedHi All,
I have installed the dev version and added an API key to my Geocoder but I still get an "Oops! Something went wrong. This page didn't load Google Maps correctly. See the JavaScript console for technical details." error.
Any help or suggestions?
I am not sure how to add any patches
Comment #12
orkineo CreditAttribution: orkineo commentedHi, the best way to apply a patch is to follow the community guidelines detailed here: https://www.drupal.org/patch/apply
In the case of this pacth which is very simple, I advise you to open the corresponding files (README.txt, google_store_locator.install and google_store_locator.module) and add the lines preceded by a + in the Rodrigo file . To find out where to place each line, simply look in your files for the previous lines that are already there. Do not forget to remove the + to the lines you are going to add so that the new code is taken into account.
This will solve the problem if you have the correct versions of each module required as well as the corresponding libraries.
Comment #13
howdytom CreditAttribution: howdytom commented#8 worked for me too. Thank you!
Is it required to add the Google Maps API key twice?
I have added the API key to:
admin/config/search/google_store_locator
admin/config/content/geocoder
Comment #14
orkineo CreditAttribution: orkineo commentedHello,
You actually need to enter the key twice:
- The Geocoder module needs it to generate the coordinates of the address from your store location
- And the store locator module to display the general map.
Comment #16
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedThanks everyone for improving and testing the patch and also give support to the community.
I have committed the changes in dev version of the module. If you could please test this version to check if everything if working fine.
Comment #17
roberthpchao CreditAttribution: roberthpchao commentedIt still not showing the map, still missing key. I have updated with dep verion and I have key entered into both geo and store locator. Please help.
Comment #18
rodrigoeg CreditAttribution: rodrigoeg at CI&T commented@roberthpchao,
Are you still seeing the same warnings in the console of your browser?
Sorry if it was done before, but could you please try to clear drupal caches and also your browser caches?
Comment #19
howdytom CreditAttribution: howdytom as a volunteer commented@rodrigoeg: I just want to let you know that 7.x-1.x-dev works for me, too. This is a huge improvement. Thank you for your patch.
Any plans for committing the changes to the stable Google Store Locator release 7.x-1.2?
Comment #20
howdytom CreditAttribution: howdytom as a volunteer commentedComment #21
howdytom CreditAttribution: howdytom as a volunteer commentedComment #22
roberthpchao CreditAttribution: roberthpchao commentedI am using Kickstart, tried 3 times clear caches, all returns "gateway timeout". Changed API (no restriction) in between. Cleared browser caches, but still encounter the same problem.
Comment #23
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedHi, @howdytom,
It will released in the next version (probably number 7.x-1.3) in a few days.
Comment #24
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedHi @roberthpchao,
Were you facing this same problem even before upgrading this module to 1.x-dev?
It seems to be a PHP timeout issue. Maybe your PHP timeout is too small.
Comment #25
roberthpchao CreditAttribution: roberthpchao commentedHi Rodrigoeg,
Yes, same issue (java console say missing api key) before installing 1.x-dev. After installed 1.x-dev. I entered api key in both store locator and geocoder module. (before had only geo)
Thank you.
Comment #26
gajanannehul CreditAttribution: gajanannehul as a volunteer and at Clarion Technologies commentedAfter applying the patch getting error
TypeError: marker is null ()
marker.setVisible(false); (google_store_locator.js line number 606).
because of above issue search box is not working. After console.log(marker); I ma getting "null" every time.
Comment #27
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedHi, @gajanannehul,
I think your new problem is related with the issue #2473595: "Where are you?" location doesn't do anything.... Please try to apply that other patch also to see it works.
Comment #28
orkineo CreditAttribution: orkineo commentedSure enough, I had this problem if I used GeoJSON 7.x-1.0-beta3 with Google Store Locator 7.x-1.2 and the pacth quoted by Rodrigo # 27 solved the problem.
Comment #29
rodrigoeg CreditAttribution: rodrigoeg at CI&T commentedNew release created with these changes: 7.x-1.3