Is this useful? Like it.
A guide on adding Google Maps to the Zen Cart contact page was already posted on August 4, 2009. That earlier guide requires the modification of TWO template files.
Today’s guide will provide you with the steps to achieve the same result, but requires you to edit only ONE template file.
The only file involved is tpl_contact_us_default.php.
Copy the tpl_contact_us_default.php file from your default template to your custom template:
Download this file from your server to your computer:
Upload the file to:
Now, check that your contact page still works as usual in the web browser.
Note: CUSTOM_TEMPLATE is the folder name of the template you are using.
Note: If you already have the tpl_contact_us_default.php file in your CUSTOM_TEMPLATE folder, don’t overwrite it. Skip directly to Step 2.
Then unzip and open the text file, copy all lines and paste to your tpl_contact_us_default.php file. Paste to around line 48. See screenshot example below.
Changes that MUST be done to your tpl_contact_us_default.php file:
- Get your API key from Google — Go to http://code.google.com/apis/maps/signup.html, enter your domain and get the key (it’s a long line of seemingly random characters)
- Copy and paste the key — replace the text YOUR_API_KEY_HERE with your key (around line 50)
- Get the exact latitude/longitude of your business location at http://www.gorissen.info/Pierre/maps/googleMapLocation.php
- Replace the (latitude,longitude) data (two locations — around line 90 and 95).
- Change the business name/details (around line 75).
- Upload the tpl_contact_us_default.php file to the correct folder:
Optional changes (tpl_contact_us_default.php)
- Around line 53, you can see the declaration for the width and height of the map. Change to suit.
- Around line 90, you can see the zoom level of the map is set to 16, map.setCenter(new GLatLng(40.728848,-73.995645),16);
Set to a zoom level you prefer, with 0 being the coarsest level.
Compatibility: Zen Cart 1.3.8, 1.3.9
Database patches: None
Core files modification: None
Browsers tested: Firefox, Chrome, IE6, IE7, IE8, Safari, Opera