Blog

/

Instructions

/

Google no longer supports keyless access

Google no longer supports keyless access

Recently there were some changes in the work of Google Maps. Google no longer supports keyless access - http://googlegeodevelopers.blogspot.ru/2016/06/building-for-scale-updates-to-google.html

So, it's necessary to get API key for correct work of Google Maps - https://developers.google.com/maps/documentation/javascript/get-api-key

These changes was taken into consideration in our new version Open Real Estate 1.17.0 (June, 28, 2016). You can enter the key in Settings. As for elder versions, you should change lines in the code.

In the file: protected/modules/apartments/components/CustomGMap.php

change line:
$js1 = 'https://maps.google.com/maps/api/js?v=3.5&sensor=false&callback=initGmap&language='.Yii::app()->language;

to:
$js1 = 'https://maps.google.com/maps/api/js?v=3&key='.param('googleMapApiKey').'&callback=initGmap&language='.Yii::app()->language;

In the files: protected/modules/apartments/views/backend/_form.php
Atlas theme: themes/atlas/views/modules/userads/views/_form.php
Classic theme: themes/classic/views/modules/userads/views/_form.php

Change the code:

if(!param('useGoogleMap')){
Yii::app()->getClientScript()->registerScriptFile('https://maps.google.com/maps/api/js??v=3.5&language='.Yii::app()->language.'', CClientScript::POS_END);
}

to:

if(!param('useGoogleMap')){
Yii::app()->getClientScript()->registerScriptFile('https://maps.google.com/maps/api/js?v=3&key='.param('googleMapApiKey').'&language='.Yii::app()->language.'', CClientScript::POS_END);
}

In the file: protected/config/main.php (paid version)
protected/config/main-free.php (free version)

add parameter googleMapApiKey at the bottom -

'params'=>array(
'googleMapApiKey' => 'YOUR API KEY',