Results 1 to 6 of 6

Thread: Fix to Vantage google-maps.php code

  1. #1
    Thread Starter
    joes's Avatar
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    877
    Thanks
    12
    Thanked 358 Times in 261 Posts

    Fix to Vantage google-maps.php code

    Numerous topics about why Vantage maps are not working:

    http://forums.appthemes.com/help-usi...-google-90267/

    http://forums.appthemes.com/help-usi...nt-work-93865/

    http://forums.appthemes.com/help-usi...working-93933/


    I had a look at my site to see if there was any problems.

    The maps load up OK.

    I then had a look at the "Firefox Firebug Console" and it was displaying the error:

    HTML Code:
    Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
    So I had a look at what URL was been generated by Vantage to load up the maps and it was:

    HTML Code:
    http://maps.google.com/maps/api/js?v=3&ver=3#038;sensor=false&region=au&language=en&key=xxxxxxxxxxxxxxxxxx
    Definitely the "key=xxxxxxxxx" is been provided in the URL (xxxx - blanked out) as to what I had entered in the "Vantage->Geo Services->Map - Google TAB->API Key", so this part is working ok.

    But it appears Google is not receiving the KEY.

    I then logged into "Google API Manager" and looked at the "Google Maps JavaScript API" Usage page to see what activity there was and it showed NO Activity.

    It turns out that the Vantage generated URL is NOT working correctly and the problem is due to the "ver=3#038;" been added to the URL, that is the "#038;" is been added instead of "&".

    The "#038;" is been added by the wordpress function wp_enqueue_script.

    I then altered the "vantage\includes\geo\map-providers\google-maps.php" code so that the "ver=3#038;" is not added to the URL:

    From:

    PHP Code:
        wp_enqueue_script'google-maps-api'$google_maps_url, array(), '3'true ); 
    To:

    PHP Code:
        wp_enqueue_script'google-maps-api'$google_maps_url, array(), nulltrue ); 

    After this change the maps worked and the Vantage generated URL is now:

    HTML Code:
    http://maps.google.com/maps/api/js?v=3&sensor=false&region=au&language=en&key=xxxxxxxxxxxxxxxxxx

    Success: Most importantly the "Google Maps JavaScript API" Usage page is NOW showing activity, hence the KEY is been received by Google.


    But still in "Firefox Firebug Console" I am getting the error:

    HTML Code:
    Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required
    After reading up on Google Maps API, the "sensor=false" and the "v=3" values provided in the URL are not required anymore.


    I removed these from "vantage\includes\geo\map-providers\google-maps.php" code:

    From:

    PHP Code:
            $params = array(
                
    'v' => 3,
                
    'sensor' => 'false',
                
    'region' => $options['geo_region'],
                
    'language' => $options['geo_language'],
            ) 
    To:

    PHP Code:
            $params = array(
                
    'region' => $options['geo_region'],
                
    'language' => $options['geo_language'],
            ); 

    After this change, the Maps are working in Vantage, "Google Maps JavaScript API" Usage page is receiving the key and no more map generated errors in Firefox Console.

  2. #2
    milsou's Avatar
    Join Date
    Oct 2010
    Location
    France
    Posts
    146
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    Thread Starter
    joes's Avatar
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    877
    Thanks
    12
    Thanked 358 Times in 261 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #4
    Thread Starter
    joes's Avatar
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    877
    Thanks
    12
    Thanked 358 Times in 261 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #5
    Expired Customer guiadelamujer's Avatar
    Join Date
    Aug 2015
    Posts
    110
    Thanks
    10
    Thanked 9 Times in 7 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #6
    Thread Starter
    joes's Avatar
    Join Date
    Nov 2012
    Location
    Australia
    Posts
    877
    Thanks
    12
    Thanked 358 Times in 261 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can I change the google maps api location code?
    By leandro275 in forum Go Fetch Jobs
    Replies: 0
    Last Post: June 25th, 2016, 04:19 PM
  2. Has anyone had succees with Google Maps API code ???
    By stevenr999 in forum JobRoller General Discussion
    Replies: 1
    Last Post: June 10th, 2015, 10:07 AM
  3. Jomark google maps wont fix on a post code
    By glenukp in forum Report JobRoller Bugs
    Replies: 3
    Last Post: July 24th, 2014, 05:39 AM
  4. Need google.maps code
    By ronaruba in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: August 29th, 2011, 09:37 AM