Complete step for Autocomplete script that I include ()
Step 1: put the script on the EGMap extension
Step 2: Add this function on EGMap.php
public function addAutocomplete($inputId = null)
{
if ($inputId === null)
$autocomplete = new EGMapAutocomplete();
else
$autocomplete = new EGMapAutocomplete($inputId);
$this->resources->add('autocomplete', new CTypedList('EGMapAutocomplete'));
$this->resources->itemAt('autocomplete')->add($autocomplete);
}
public function getAutocompleteJs()
{
$return = '';
if (null !== $this->resources->itemAt('autocomplete'))
{
foreach ($this->resources->itemAt('autocomplete') as $autocomplete)
{
$return .= $autocomplete->toJs($this->getJsName());
$return .= "\n ";
}
}
return $return;
}
Step 4: Still in the EGMap.php find the function public function registerMapScript and add this line
$params .= '&libraries=places';
before
CGoogleApi::init();
and this line
$init_events[] = $this->getAutocompleteJs();
after the other $init_events[]
and to call the autocomplete… use this
$gMap->addAutocomplete();
You must have input field with id searchTextField or if you want customid just put it inside the
$gMap->addAutocomplete($customid);
*This script assumes you already have a default marker with info window.
You can still play with script base on your needs