Jump to content
xt:Commerce Community Forum

Google map


pixeleyes

Recommended Posts

Einbindung der Google-map im Kontaktformular (umgeändert vom ZenCart-Modul):

1.API key holen von google (http://www.google.com/apis/maps/signup.html)

2. Danach am besten zu http://maps.google.com/maps/mm?mapprev=1 gehen und da eine eigene karte anlegen.

Sollten Sie dies gemacht haben, klicken Sie oben auf "URL zu dieser Seite".

kopieren Sie dann aus der Url folgendes:

z.b. http://maps.google.com/maps/mm?mapprev=1&ie=UTF8&ll=51.225163,6.785431&spn=0.054935,0.186768&z=13&om=1

51.225163,6.785431 stehen für Latitude, Longitude

2. Tragen Sie die Daten in Admin/Mein Shop ein

includes/heaader.php /////////////////////////////////////////////

Zeile ca 262

if (strstr($PHP_SELF, FILENAME_POPUP_IMAGE )) {

echo '<body onload="resize();"> ';

} else {

echo '<body>';

}

ersetzen durch

if (strstr($PHP_SELF, FILENAME_POPUP_IMAGE )) {

echo '<body onload="resize();"> ';

}elseif (strstr($PHP_SELF, FILENAME_CONTENT )) {

echo '<body onunload="GUnload();" onload="GoogleMapLoad();">';

}

else {

echo '<body>';

}

shop_content.php //////////////////////////////////////////////////////

nach require (DIR_WS_INCLUDES.'header.php');

// Google

function nl2brStrict($text, $replacement = '<br />')

{

return preg_replace("((\r\n)+)", trim($replacement), $text);

}

$smarty->assign('GOOGLEMAP_KEY', nl2brStrict(GOOGLEMAP_KEY));

$smarty->assign('GOOGLEMAP_LNG', nl2brStrict(GOOGLEMAP_LNG));

$smarty->assign('GOOGLEMAP_ZOOM', nl2brStrict(GOOGLEMAP_ZOOM));

$smarty->assign('GOOGLEMAP_LAT', nl2brStrict(GOOGLEMAP_LAT));

$smarty->assign('STORE_NAME_ADDRESS', nl2brStrict(STORE_NAME_ADDRESS));

$smarty->assign('STORE_TELEPHONE', nl2brStrict(STORE_TELEPHONE));

templates/ihrtemplate/module/contact_us.html ///////////////////////////////////

<div id="map" style="width: 100%; height: 350px; border:solid black 1px;" ></div>

{literal}

<script src="http://maps.google.com/maps?file=api&v=2&key={/literal}{$GOOGLEMAP_KEY}{literal}"

type="text/javascript"></script>

<script type="text/javascript">

//<![CDATA[

function GoogleMapLoad()

{

if (GBrowserIsCompatible())

{

var map = new GMap2(document.getElementById("map"));

map.setCenter(new GLatLng({/literal}{$GOOGLEMAP_LAT}{literal},{/literal} {$GOOGLEMAP_LNG}{literal}), {/literal}{$GOOGLEMAP_ZOOM}{literal});

map.addControl(new GMapTypeControl());

map.addControl(new GSmallMapControl());

var point = new GLatLng({/literal}{$GOOGLEMAP_LAT}{literal}, {/literal}{$GOOGLEMAP_LNG}{literal});

var infoTabs = [

new GInfoWindowTab("Address", "{/literal}{$STORE_NAME_ADDRESS}{literal}"),

new GInfoWindowTab("Telephone", "{/literal}{$STORE_TELEPHONE}{literal}")

];

var marker = new GMarker(point);

GEvent.addListener(marker, "click", function() { marker.openInfoWindowTabsHtml(infoTabs);});

map.addOverlay(marker);

marker.openInfoWindowTabsHtml(infoTabs);

}

}

//]]>

</script>

{/literal}

datenbank /////////////////////////////////////////////////////////////

INSERT INTO `configuration` (`configuration_id`, `configuration_key`, `configuration_value`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (516, 'GOOGLEMAP_KEY', 'xxxxxxxxxxxxxxxxx', 1, 18, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'NULL', NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_key`, `configuration_value`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (517, 'GOOGLEMAP_LAT', 'xxxxxxxxxxxxx', 1, 18, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'NULL', NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_key`, `configuration_value`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (518, 'GOOGLEMAP_LNG', 'xxxxxxxxxxxx', 1, 18, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'NULL', NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_key`, `configuration_value`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (519, 'GOOGLEMAP_ZOOM', '14', 1, 18, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'NULL', NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_key`, `configuration_value`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (520, 'GOOGLEMAP_MINIMAP', 'true', 1, 18, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'NULL', 'xtc_cfg_select_option(array(''true'', ''false''),');

INSERT INTO `configuration` (`configuration_id`, `configuration_key`, `configuration_value`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (521, 'GOOGLEMAP_MAPCONTROL', 'none', 1, 18, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'NULL', 'xtc_cfg_select_option(array(''small'', ''large'',''none''),');

lang/admin/configuration.php /////////////////////////////////////////////////

define('GOOGLEMAP_KEY_TITLE' , 'Google Maps API Key');

define('GOOGLEMAP_KEY_DESC' , 'The Google Maps api key');

define('GOOGLEMAP_LAT_TITLE' , 'Google Maps API Latitude');

define('GOOGLEMAP_LAT_DESC' , 'enter your latitude (example 53.29811969600611)');

define('GOOGLEMAP_LNG_TITLE' , 'Google Maps API Longitude');

define('GOOGLEMAP_LNG_DESC' , 'enter your longitude (example -3.514702320098877)');

define('GOOGLEMAP_ZOOM_TITLE' , 'Zoom Level');

define('GOOGLEMAP_ZOOM_DESC' , 'enter your default zoom level');

define('GOOGLEMAP_MINIMAP_TITLE' , 'GoogleMap MiniMap');

define('GOOGLEMAP_MINIMAP_DESC' , 'Shows the minimap');

define('GOOGLEMAP_MAPCONTROL_TITLE' , 'Google Map Control');

define('GOOGLEMAP_MAPCONTROL_DESC' , 'Sets the size of the map controls');

Link to comment
Share on other sites

  • 9 months later...

datenbank tabellen lassen sich nicht erstellen irgend ein syntax ist verhaltet.

wo soll ...... define('GOOGLEMAP_KEY_TITLE' , 'Google Maps API Key');

define('GOOGLEMAP_KEY_DESC' , 'The Google Maps api key');

define('GOOGLEMAP_LAT_TITLE' , 'Google Maps API Latitude');

.....

eingefügt werden?

Link to comment
Share on other sites

Warum macht ihr euch das Leben den so schwer?

Ich hab auf unserem Shop auch die Map. Klar, API Key muss vorhanden sein. Sonst bin ich hingegangen, hab alles in ner html Datei fertig gemacht wie es aussehen soll, die dann in media/content/ rein fertig. Noch im Admin auswählen (Content manager) fertig ist das :)

Link to comment
Share on other sites

  • 10 months later...

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...