Here is some of the conversion to use google api V3 instead of the V2 that is currently used in the Com-property component. There are still quite a few locations in the component that reference old google V2 api code which I would like to upgrade if I new what the code was actually for.
However, for the map display here's what I've done so far and it seems to work correctly.
The changes that were made to make this work with the existing application are:
\components\com_properties\controller.php:
Do a search for 'google' in the file and you'll find the location. (approx line 271) Replace the old function load() code and the old google maps javascript reference with the following:
| Code: |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
//<![CDATA[
function initialize() {
var myLatlng = new google.maps.LatLng(<?php echo $lat;?>, <?php echo $lng;?>);
var myOptions = {
zoom: <?php echo $distancia;?>,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map"), myOptions);
var image = "<?php echo JURI::base();?>components/com_properties/includes/img/house.png";
var myLatLng = new google.maps.LatLng(<?php echo $lat;?>, <?php echo $lng;?>);
var houseMarker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image
});
var contentString = '<?php echo $myHtml;?>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(houseMarker, 'click', function() {
infowindow.open(map,houseMarker);
});
}
//]]>
</script>
</head>
<body onload="initialize()" style="width: 750px; height: 495px;">
|
\components\com_properties\views\templates\details.php:
Do a search for 'google' in the file and you'll find the location. (approx line 905) Replace the old function loadmap code and the old google maps javascript reference with the following:
| Code: |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function loadmap() {
var myLatlng = new google.maps.LatLng(<?php echo $lat;?>, <?php echo $lng;?>);
var myOptions = {
zoom: <?php echo $distancia;?>,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map"), myOptions);
var image = "<?php echo JURI::base();?>components/com_properties/includes/img/house.png";
var myLatLng = new google.maps.LatLng(<?php echo $lat;?>, <?php echo $lng;?>);
var houseMarker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image
});
}
</script>
|
\components\com_properties\views\templates\details1.php:
Do a search for 'google' in the file and you'll find the location. (approx line 907) Replace the old function loadmap code and the old google maps javascript reference with the following:
| Code: |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function loadmap() {
var myLatlng = new google.maps.LatLng(<?php echo $lat;?>, <?php echo $lng;?>);
var myOptions = {
zoom: <?php echo $distancia;?>,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map"), myOptions);
var image = "<?php echo JURI::base();?>components/com_properties/includes/img/house.png";
var myLatLng = new google.maps.LatLng(<?php echo $lat;?>, <?php echo $lng;?>);
var houseMarker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image
});
}
</script>
|
\components\com_properties\views\templates\details2.php:
Do a search for 'google' in the file and you'll find the location. (approx line 756) Replace the old function loadmap code and the old google maps javascript reference with the following:
| Code: |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function loadmap() {
var myLatlng = new google.maps.LatLng(<?php echo $lat;?>, <?php echo $lng;?>);
var myOptions = {
zoom: <?php echo $distancia;?>,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map"), myOptions);
var myLatLng = new google.maps.LatLng(<?php echo $lat;?>, <?php echo $lng;?>);
var marker = new google.maps.Marker({
position: myLatLng,
map: map
});
}
</script>
|