Ciao a tutti, ho installato una contrib sul mio oscommerce che mi permette di visualizzare sulla mappa di google la locazione geografica dei vari utenti che hanno ordinato.
Funziona alla grande ma l'unica cosa è che all'apertura della pagina la mappa si posizione sulla germania (la contrib infatti nativa era tedesca).
Come potremmo fare per spostarla sull'italia? Grazie!
Ecco il codice e scusate se non ho postato nella sezione giusta...
Codice PHP:
<script src="http://maps.google.com/maps?file=api&v=2&key=<?php echo GOOGLEMAP_APIKEY; ?>"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map = null;
// A function to create the marker and set up the event window
function createMarker(point, orders_id, wert)
{
// Create our "tiny" marker icon
var icon = new GIcon();
if (wert < <?php echo MAP_HIGHLIGHTVALUE; ?>)
icon.image = "images/125.png";
else
icon.image = "images/101.png";
icon.shadow = "images/shadow50.png";
icon.iconSize = new GSize(20, 34);
icon.shadowSize = new GSize(37, 34);
icon.iconAnchor = new GPoint(10, 34);
icon.infoWindowAnchor = new GPoint(10, 10);
var marker = new GMarker(point, {icon:icon, title:orders_id});
var html = "<a href=\"orders.php?oID=" + orders_id + "&action=edit\" target=\"_blank\"><?php echo MAP_DETAIL_TXT; ?> #" + orders_id + "</a>";
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GOverviewMapControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(<?php echo MAP_CENTER_LAT; ?>, <?php echo MAP_CENTER_LNG; ?>), <?php echo MAP_CENTER_ZOOM; ?>);
map.enableScrollWheelZoom(); // Scrollrad-Zoom
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(100,10));
pos.apply(document.getElementById("control"));
map.getContainer().appendChild(document.getElementById("control"));
<?php
$customers_query_raw = "select orders_id, lat, lng from orders_to_latlng";
$customers_query = tep_db_query($customers_query_raw);
while ($customers = tep_db_fetch_array($customers_query))
{
$orders_query_raw = "select value from orders_total WHERE orders_id=" . $customers['orders_id'] . " AND class LIKE 'ot_subtotal'";
$orders_query = tep_db_query($orders_query_raw);
$order = tep_db_fetch_array($orders_query);
echo "var marker = createMarker(new GLatLng(" . $customers['lat'] . "," . $customers['lng'] . "), \"" . $customers['orders_id'] . "\", \"" . $order['value'] . "\"); \n";
echo "map.addOverlay(marker);\n";
}
?>
}
}
//]]>
</script>