OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: EasyMap
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Contributions / Add-Ons > General Contribution Support
Pages: 1, 2
Jack_mcs
This contribution adds a map to your shop via google's map API. The default settings show how lines can be drawn on the map to provide driving instrucitons. This would be limited to a local ara but may be useful to some people. It also has a Satellite display that is quite impressive.

I will upload it shortly so the support thread is included.

Jack
Jack_mcs
Here is the contribution, I forgot to mention that to use this, you will need to get an API key from google. It is a simple process and just takes a few minutes.

Jack
lrparr
Hi Jack, do you have this running on your site? If so could I get your URL, or do you know that URL of a site that is running this? I'd like to see what it looks like and does before taking the time to intall.

Thanks!
Jack_mcs
You can see samples here . I do my testing in FireFox so I didn't notice that this doesn't work in IE. It is because of a javascript problem in IE and there is a fix for it. I should have that uploaded today. So, to anyone who has downloaded it, please keep that in mind.

Jack
Jack_mcs
I've uploaded a new version. It fixes the IE javascript problem and has two mew options added.

Jack
jcall
Looks very nice, Jack!

-jared
Jack_mcs
Thanks, I appreciate that. )

Jack
stephen495
Thanks for Easymap. It is working well except for a conflict with On the Fly Thumbnailer:
Division by Zero error in On the Fly Thumbnailer module at line 83 of html_outputp.php (see at the bottom of pasted code)
Any ideas on how to exclude Google maps from the thumbnailer process, or other possible fixes?


// "On the Fly Thumbnailer" using PHP GD Graphics Library by Nathan Welch (v1.5)
// Scales product images dynamically, resulting in smaller file sizes, and keeps
// proper image ratio. Used in conjunction with product_thumb.php t/n generator.
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {

// Set default image variable and code
$image = '<img src="' . $src . '"';

// Don't calculate if the image is set to a "%" width
if (strstr($width,'%') == false || strstr($height,'%') == false) {
$dont_calculate = 0;
} else {
$dont_calculate = 1;
}

// Do we calculate the image size?
if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) {

// Get the image's information
if ($image_size = @getimagesize($src)) {

$ratio = $image_size[1] / $image_size[0];

// Set the width and height to the proper ratio
if (!$width && $height) {
$ratio = $height / $image_size[1];
$width = intval($image_size[0] * $ratio);
} elseif ($width && !$height) {
$ratio = $width / $image_size[0];
$height = intval($image_size[1] * $ratio);
} elseif (!$width && !$height) {
$width = $image_size[0];
$height = $image_size[1];
}

// Scale the image if larger than the set width or height
if ($image_size[0] > $width || $image_size[1] > $height) {
[Line 83] $rx = $image_size[0] / $width;
Jack_mcs
I don't use that contribution so I can't say for sure. You could try tessting to see if the page being displayed is the map page and if it is, just retrun from the function. I would have to look at the code to see what effect that would have. You would probably get a betteer answer by asking in the support thread for that contribution.

Jack
tedbooks
is there a way of adding store lpgo to the text in the info window that opens on top of the maker
Jack_mcs
Google has a way of doing it but that method isn't included in the contribution. I will look into adding it at some point.

Jack
pnkranger
QUOTE (Jack_mcs @ Jan 27 2006, 09:43 PM) *
Google has a way of doing it but that method isn't included in the contribution. I will look into adding it at some point.

Jack



Jack,

For some reason, STS kills the map. I have tried posting the java in an external file and requiring its inclusion in the easymap.php file, but STS is still keeping it from loading. I disable STS and it works.

Any ideas?

Thanks,

Nick
Jack_mcs
No, I don't use STS so I can't help you.

Jack
guanche
I have entered the new long & lat coordinates via admin yet it still outputs the default Palo Alto map instead of my location, is there another place I am supposed to place the coordinates?
Jack_mcs
Changing those works for me. What happens if you try to move the map? Does it switch to the proper location?

Jack
guanche
QUOTE (Jack_mcs @ Apr 17 2006, 03:00 PM) *
What happens if you try to move the map? Does it switch to the proper location?


Jack,


When I move the map it doesn't switch to the proper location but remains with the default Palo Alto as if the new corrdinates did not take, howver when I take a look in admin the new lat & long are there and they also show up on the easpmap.php page. I am using the latest EasyMaps update release, perhpas I did something wrong or it is in conflict with another contribution I have installed.

On another note, is there an easy way to show maps & directions to two different locations?

Joe
airsoftmart
Hi

Is it possible to change the size of the map

Mark
Jack_mcs
QUOTE (guanche @ Apr 17 2006, 07:55 PM) *
Jack,
When I move the map it doesn't switch to the proper location but remains with the default Palo Alto as if the new corrdinates did not take, howver when I take a look in admin the new lat & long are there and they also show up on the easpmap.php page. I am using the latest EasyMaps update release, perhpas I did something wrong or it is in conflict with another contribution I have installed.

On another note, is there an easy way to show maps & directions to two different locations?

Joe
The version I uploaded works. I haven't looked at the latest upload. Hopefully the person that did that will support it.

Jack
lonestarphd
Here's something for you hackers to figure out. For every customer in the database, I would like to add the latitude and longitude of their city and use Google Maps to show where all my customers are. I have sold all over the world on eBay (about 1500 customers) and want to map them on my soon-to-be osCommerce site. It would add legitimacy to the site.
Jack_mcs
You would first have to edit your customers table to store their longitude and lattitude, or use some sort of look up code to find it. Then call in that information for the customer on the EasyMap page and use those coordinates instead of the ones from the database. So, yes, it is doable but the majority of code would have to do with coming up with the coordinates in the first place.

Jack
walkman
Does anyone have an example of a working osc website that has this contribution installed?
lonestarphd
QUOTE (Jack_mcs @ May 19 2006, 12:58 PM) *
You would first have to edit your customers table to store their longitude and lattitude, or use some sort of look up code to find it. Then call in that information for the customer on the EasyMap page and use those coordinates instead of the ones from the database. So, yes, it is doable but the majority of code would have to do with coming up with the coordinates in the first place.

Jack


Looks like I may be able to get the info online from the census bureau for each zip code.
Jack_mcs
QUOTE (walkman @ Jun 15 2006, 10:08 AM) *
Does anyone have an example of a working osc website that has this contribution installed?
Please take a look at a few posts back.

Jack
rabbitseffort
Hi Jack--so is the one pnkranger uploaded ok or is the last one you uploaded the one to use? I would rather use one I know works from the get go.
Jack_mcs
I haven't tried the one he uploaded so I can't say either way.

Jack
wheeloftime
QUOTE (Jack_mcs @ Jun 16 2006, 05:45 AM) *
I haven't tried the one he uploaded so I can't say either way.

Jack

I just did and the version which works is 1.1 from Jack. The the 2.2 version is, sorry to say, pretty messed up (the right column dissapears, there are non-default css classes used wich are not with the installation instructions and ..I didn't look/try any further). Maybe 2.1 works but I haven't bothered to try that one.
The only thing I changed in Jacks version is (change v=1 to v=2 and replacing the key)
CODE
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAQ0TDPKrx6z1NemzAhlXYOBRUe8DPUYDAMEqax7Lj8284ASqs7xRNt2NEAP0NMc1l
teeav05-Dt7Uew" type="text/javascript"></script>


I did load the 2.2 SQL though but the newer stuff is not used with the 1.1 version. Looks very nice though !
kbking
I tried to add EasyMap version 1.1. I can see that it works fine, but the map isn't in the 500px x 400px area as it should be. Instead it shows up in the column left. I cant figure why it appears that much off.
kbking
Sorted it. I had another contrib that had the same div id.
Antonimo
STSv4_2 and EasyMap

It could just be me being a ittle confused, but in order to get EasyMap to work with STSv4_2 I used trial and error. Here are my notes for anyone else who needs - if there are any major flaws in this technique, please let me know.

Having installed EasyMap as per the installation instructions, I created the file "easymap.php.html".

I saved "easymap.php.html" into the directory catalog/includes/sts_templates/test/ beacuase this is where I have the Default Template that I configured in the Admin section.

I then created a copy of the Default Template I'm using and added the lines mentioned in the install instructions
CODE
FIND:

<html>

AND REPLACE WITH:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">

FIND

<body

AND ADD AFTER "body" but before any other variables (i.e, bgcolor, topmargin, etc.):

onLoad="load()" onUnload="GUnload()"
This has worked for me
sitandspin
Has anyone figured out how to use this with Google's geocoder in their API documentation? I'm looking for a nicer way of putting the address into the map.
sonixtwo
When I am creating the database tables, I get the following error:

INSERT INTO configuration_group
VALUES (
'30', 'EasyMap', 'EasyMap - configuration options', '30', '1'
);

MySQL said: Documentation
#1062 - Duplicate entry '30' for key 1

I'm guessing the format must be wrong. How can I fix this? Thanks

-Mike
Jack_mcs
The 30 in that error is referring to the configuration_group ID. It failed because there was already an entry in the database using that. You need to edit the sql file and change the '30' entries to something else. If you are comfotable going into phpmyadmin, you can see what the next number can be. But it doesn't matter since it is only used internally. If you change it to something higher, like 40 or 99, it should work.

Jack
adamfalletta
Hello Jack - Can you please answer a few questions I have.
How can I enable your map system for a real estate web site.
An example can be found here at http://www.vivending.es/. When you click a listing it shows the link MAP. When clicked it shows the homes location within a pop up. Is this your contribution or a different one. Your feedback in deeply valued. Thank you - Adam - Brooklyn NY
Jack_mcs
No, that's not the google sitemap. I will PM you a link to the one my version of the contribution provides.

Jack
sonixtwo
QUOTE (Jack_mcs @ Jan 9 2007, 11:31 PM) *
The 30 in that error is referring to the configuration_group ID. It failed because there was already an entry in the database using that. You need to edit the sql file and change the '30' entries to something else. If you are comfotable going into phpmyadmin, you can see what the next number can be. But it doesn't matter since it is only used internally. If you change it to something higher, like 40 or 99, it should work.

Jack


That did it. Thanks very much!

-Mike
Mythical
Hi Jack,

I'm currently building a prototype using osCommerce but instead of users paying, retailers will pay to post specials. Fiddling with the ecommerce aspect of this endeavour will be left for later. However, I'm using Multi-Store and have it enabled with the French language as well and I'm trying to set it up so that each store can add their address.

I will potentially include a geocoder iframe in the admin portion for each store (also more coding than I will be capable of but I should have help soon) Once the retailer types in their address, they can get the longitude and latitude of their store and save this value in their profile. The geocoder exists at: http://geocoder.ca/?addresst=&stno=&am...t=GeoCode+it%21

The site I'm designing can currently be seen at http://www.shopters.com/0/ though I have yet to figure out how to enable all the functions, any help or suggestions are much appreciated and any involvement on your part will be noted when this platform is launched, I'm taking a look at your contrib as we speak, thanks!
Jack_mcs
Enable all of the functions of what? The geocoder? If so, I have never looked at that so I can't offer any suggestions for it.

Jack
Goanna
I just wanted to see if I misunderstood a function of this contribution.

The line drawing for directions, is that just a task I can do from the admin end?

When I read that, I thought I would be able to put a form on the map page, and have turn by turn directions listed, without having to difer my users to another site (google maps).

I actually have done this before and I have working code examples that will do this if your interested in building that functionality into this. I was warned though that it may be against googles TOS to do so. Nobody seemed to be sure at the time. It's been over a year since I played with it/looked into it though.
Jack_mcs
It draws a map on the screen and you can overlay directions to your store (from some known point).

Jack
Goanna
QUOTE (Jack_mcs @ May 30 2007, 10:23 PM) *
It draws a map on the screen and you can overlay directions to your store (from some known point).

Jack


Egghh, not very usefull for me. I'll see if I can tie in actual driving directions into this, with geocoding and a form for people to submit their street address. If it works out ill release it as an update.

Billy
Goanna
Okay I have added some basic driving direction capability. I havent yet added any new database fields to support this but I plan on adding a few more to make the whole thing configurable from the admin area.

For the time being here's what I have. I am still working some bugs out, and I may wind up changing things around but I'll post the code here now if anyone wants to play with it.

Basically, when you first visit the page you get the original easymap component but I added a form on the bottom asking for a start address. When the address is submitted you then get taken to a page showing turn by turn directions and a map with a polyline drawn along the route, as well as zoom/view controls.

CODE
<?php
/*
  $Id: easymap.php,v 1.1 2005/12/31 by Jack_mcs
  Turn by Turn Driving directions functionality added by Goanna

  osCommerce, Open Source E-Commerce Solutions
  [url=http://www.oscommerce.com]http://www.oscommerce.com[/url]

  Copyright © 2003 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_EASYMAP);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_EASYMAP));
    
  $action = (isset($_POST['action']) ? $_POST['action'] : '');
  $line = array();
  $line = explode(",", EM_LINES_COORD);


  $longitude = EM_LONGITUDE;
  $lattitude = EM_LATTITUDE;
  $to = "123 main street washington dc"; //Destination address goes here formatted Street, City, State, Zip (with or without commas).
  $from = $_POST['fromAddress'];
  
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
  &lt;script src="http://maps.google.com/maps?file=api&v=2&key=abcd123456" type="text/javascript"></script>
<?php if ($getdirections == 'true'): ?>

<style type="text/css">
      v\:* {
        behavior:url(#default#VML);
      }
      body {
        font-family: Verdana, Arial, sans serif;
        font-size: 11px;
        margin: 2px;
      }
      table.directions th {
    background-color:#EEEEEE;
      }
      
      img {
        color: #000000;
      }
    </style>
    &lt;script type="text/javascript">
    //<![CDATA[

    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;
    var trafficInfo = new GTrafficOverlay();

    function load() {
      if (GBrowserIsCompatible()) {      
        map = new GMap2(document.getElementById("map"));

        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);

        setDirections("<?php echo $from; ?>", "<?php echo $to; ?>", "en_US");
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
        //map.addOverlay(trafficInfo); //Need to add a button to toggle this on/off before using.
      }
    }
    
    function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
    }

    function handleErrors(){
       if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
         alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
       else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
         alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
      
       else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
         alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

    //   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
    //     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
        
       else if (gdir.getStatus().code == G_GEO_BAD_KEY)
         alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

       else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
         alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
        
       else alert("An unknown error occurred.");
      
    }

    function onGDirectionsLoad(){
          // Use this function to access information about the latest load()
          // results.

          // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
      // and yada yada yada...
    }


    //]]>
    </script>
    
<?php else: ?>
        <!-- BOC googlemap //-->
     <style type="text/css">
    v\:* {
      behavior:url(#default#VML);
    }
    </style>
&lt;script type="text/javascript">
    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(<?php echo $longitude; ?>, <?php echo $lattitude; ?>), 14);
        
       <?php if (EM_SHOW_MAP_SIZE == 'true') {
       if (EM_SHOW_MAP_CONTROLS == 'complete') { ?>
        map.addControl(new GLargeMapControl());
        <?php } ?>
        <?php if (EM_SHOW_MAP_CONTROLS == 'compact') { ?>
        map.addControl(new GSmallMapControl());
        <?php } } ?>
      
       <?php if (EM_SHOW_MAP_VIEW == 'true') { ?>
       map.addControl(new GMapTypeControl());
       <?php } ?>

//      map.addControl(new GOverviewMapControl());
        <?php if (EM_SHOW_MAP_VIEW == 'true') { ?>
        map.addControl(new GScaleControl());
        <?php } ?>
        
        <?php if (EM_SHOW_MAP_COORDINATES == 'true') { ?>
        GEvent.addListener(map, "moveend", function() {
          var center = map.getCenter();
          document.getElementById("message").innerHTML = center.toString();
        });
        <?php } ?>
      

        // Our info window content
        var infoTabs = [
          new GInfoWindowTab("<?php echo EM_LOCATION_BUBBLE_TITLE; ?>", "<?php echo EM_LOCATION_BUBBLE_CONTENT; ?>")
          <?php if (EM_SHOW_MAP_TAB == 'true') { ?>,
          new GInfoWindowTab("<?php echo EM_LOCATION_TAB_TITLE; ?>", "<?php echo EM_LOCATION_TAB_CONTENT; ?>")
          <?php } ?>
        ];

        <?php if (EM_SHOW_MAP_MARKER == 'true') { ?>
        // Place a marker in the center of the map and open the info window
        // automatically
        var marker = new GMarker(map.getCenter());
        map.addOverlay(marker);
        
        <?php if (EM_LOCATION_MAP_BUBBLE == 'true') { ?>
        marker.openInfoWindowTabsHtml(infoTabs);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowTabsHtml(infoTabs);
        });
        <?php } } ?>
        
        <?php if (EM_SHOW_MAP_LINES == 'true') { ?>
        var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var lngSpan = northEast.lng() - southWest.lng();
        var latSpan = northEast.lat() - southWest.lat();

        // Add a polyline with five random points. Sort the points by
        // longitude so that the line does not intersect itself.
        var points = [];
        
          points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[0]; ?>,
                                  southWest.lng() + lngSpan * <?php echo $line[1]; ?>));
          points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[2]; ?>,
                                  southWest.lng() + lngSpan * <?php echo $line[3]; ?>));
          points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[4]; ?>,
                                  southWest.lng() + lngSpan * <?php echo $line[5]; ?>));
          points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[6]; ?>,
                                  southWest.lng() + lngSpan * <?php echo $line[7]; ?>));
          points.push(new GLatLng(southWest.lat() + latSpan * <?php echo $line[8]; ?>,
                                  southWest.lng() + lngSpan * <?php echo $line[9]; ?>));                          
      
        points.sort(function(p1, p2) {
          return p1.lng() - p2.lng();
        });
        map.addOverlay(new GPolyline(points));
        <?php } ?>
      }
    }

    //]]>
    </script>
    <?php endif; ?>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onload="load()" onunload="GUnload()">

<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
      <td class="columnLeft" width="<?php echo COLUMN_LEFT_WIDTH; ?>" valign="top"><table  border="0" width="<?php echo COLUMN_LEFT_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td><td background="images/links/shadow_column_left.gif">&nbsp;&nbsp;&nbsp;</td>
    <td><?php echo tep_draw_separator('pixel_trans.gif', COLUMN_SPACER_WIDTH, '1'); ?></td>

<!-- body_text //-->
<?php if ($getdirections == 'true'): ?>
      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
              <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
        </tr>
        <tr>
          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
            <tr>
              <td class="main">  
   <div id="map" style="width: 650px; height: 400px"></div>
   <br />
   <span>Formatted Directions</span>
   <div id="directions" style="width: 650px"></div></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
        </tr>
        <tr>
          <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
            <tr class="infoBoxContents">
              <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                <tr>
                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                  <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      </table></td>
<?php else: ?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td>
            <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><?php echo TEXT_INFORMATION; ?></td>
          </tr>
          <?php if (EM_SHOW_MAP_LINES == 'true') { ?>
           <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
           </tr>          
           <tr>
            <td class="main"><?php echo TEXT_DRIVING_DIRECTIONS; ?></td>
           </tr>          
          <?php } ?>        
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      
      <!-- Start map code //-->
      <tr>
       <td>
<!-- EOC googlemap //-->
<div id="map" style="width: 500px; height: 400px; border: .2em; border-style: ridge; "></div>
        <div id="message"></div>
       </td>
      </tr>

      <!-- BEGIN FORM -->
      <tr>
  <td align="right"><?php echo tep_draw_form('seotips', tep_href_link(FILENAME_EASYMAP, '', 'NONSSL'), 'post', 'onSubmit="return true;" onReset="return true"') . tep_draw_hidden_field('getdirections', 'true'); ?></td>      </tr>          
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>
      </tr>
      <tr>
       <td width="40%"><table border="1">
        <tr>
         <td>Starting Address</td>
         <td><?php echo tep_draw_input_field('fromAddress', $fromAddress, false); ?> </td>
        </tr>
       </table></td>    
      </tr>
      <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '20'); ?></td>
      </tr>  
      
      <tr>
       <td width="40%"><table border="0">  
        <tr>
         <td width="45%">&nbsp;</td>
         <td><?php echo (tep_image_submit('button_update.gif', IMAGE_UPDATE) ) . ' <a href="' . tep_href_link(FILENAME_EASYMAP, '') .'">' . '</a>'; ?></td>
        </tr>
       </table></td>
      </tr>
      <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '20'); ?></td>
      </tr>      
      </form>
    <!-- END FORM -->
    <!-- End Map code //-->

      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
          <td class="columnRight"><?php echo tep_draw_separator('pixel_trans.gif', COLUMN_SPACER_WIDTH, '1'); ?></td>
     <td >&nbsp; </td>
     <?php endif; ?>
<!-- body_text_eof //-->
<td width="<?php echo COLUMN_RIGHT_WIDTH; ?>" valign="top"><table border="0" width="<?php echo COLUMN_RIGHT_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


If you want to play around with it just overwrite your existing easymap.php file with it and give it a go. It's pretty basic right now but you should be able to modify it. Remember to put your own API key in place.
Goanna
Oh, sorry one quick thing, the API key you must change it to 2.x if you leave it at v=2 it wont work. Since I cant edit the above code, it should look like this.

CODE
<script src="http://maps.google.com/maps?file=api&v=2.x&key=abcd123456" type="text/javascript"></script>
azer
could someone help me to find the right longitude and lattitude, when i go to google maps the pointer is in the perfect location, i copy the url to this map and here it is :

CODE
http://maps.google.com/maps?q=Bredestraat+6,+6211+Maastricht,+Maastricht+(Limbourg),+Netherlands&sll=50.846177,5.690296&sspn=0.006598,0.022252&ie=UTF8&ll=50.848765,5.690446&spn=0.006598,0.022252&z=16&om=1


then i enter in my admin :

Longitude : 5.690446
Lattitude : 50.848765

and the pointer is 2 street above the right location mad.gif
finjay
Any suggestions on how to add this to a different page other than easymap.php? I'm using the BTS.
Jack_mcs
You just need to copy the code that has to do with the map (at least in my version. I haven't tried any others) into the file you want.

Jack
mrhandley
Great contrib.

Is it possible to add multiple store locations?
Have you looked in to that at all?
Jack_mcs
No, I haven't. It would be possible but not as the code is currently written. But multiple locations are possible on one map so I'm not sure there would be a need for it.

Jack
mrhandley
So how do I add multiple locations on one map? Or are you planning to add it in a near future?
Jack_mcs
The code is only setup to show one location now (at least in my version). It would not take much to change it so the various points are stored in the admin settings but a quick way to get it to work is to find this code in easymap.php
CODE
var point = new GPoint(bounds.minX + width * <?php echo EM_LOCATION_X; ?>,
                         bounds.minY + height * <?php echo EM_LOCATION_Y; ?>);
      var marker = new GMarker(point);
      map.addOverlay(marker);
Then duplicate it right under it and change the location. Try this as an example to see what I mean
CODE
      var point = new GPoint(bounds.minX + width * <?php echo EM_LOCATION_X + .04; ?>,
                         bounds.minY + height * <?php echo EM_LOCATION_Y + .04; ?>);
      var marker = new GMarker(point);
      map.addOverlay(marker);
You'll need to enable the Enable Marker option to see the above. You can add as many extra points as you want.

Jack
mrhandley
Hmmm, I can´t seem to find the
CODE
var point = new GPoint(bounds.minX + width * <?php echo EM_LOCATION_X; ?>,
                         bounds.minY + height * <?php echo EM_LOCATION_Y; ?>);
      var marker = new GMarker(point);
      map.addOverlay(marker);

code in my easymap.php. I even extraxted the zip once again to be sure to have the original file.

Is it me that is completely lost? (I´ll blame it on lack of coffey if so)

Enable marker is enabled btw.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.