Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Listings Manager Add-ons:
Google map in _publish_listing.html

 

 


sammahoney
User

Jun 16, 2007, 5:01 AM

Post #1 of 6 (11711 views)
Shortcut
Google map in _publish_listing.html Can't Post

Hi All.

I'm working on implementing the javascript/CSS tabbed windows for my listings, as detailed in the tutorial. I've added a map page, which is passed the coordinates from the corresponding fields, which then centers the map and adds a marker. However, is there some way to make the marker unclickable (as you're already viewing the info)? Everytime I try and remove the code the whole thing breaks down.
Also, is there some way that if there are no coordinates for a particular listing, that I can show an error message instead of the map just not loading?

Example with coordinates: http://www.advantagecroatia.com/listman/listings/l0017.html

Example without: http://www.advantagecroatia.com/listman/listings/l0015.html

Thanks in advance,
Sam


(This post was edited by sammahoney on Jun 16, 2007, 5:03 AM)


sammahoney
User

Jun 16, 2007, 6:47 AM

Post #2 of 6 (11703 views)
Shortcut
Re: [sammahoney] Google map in _publish_listing.html [In reply to] Can't Post

OK, fixed the marker thing, thanks to someone on Google Groups: to make your marker unclickable remove this:-


GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(output);
});


and change your if statement to this


if (longitude && latitude !=null )

Now, any ideas on the error message?


ChetW
Staff


Jun 17, 2007, 8:00 AM

Post #3 of 6 (11639 views)
Shortcut
Re: [sammahoney] Google map in _publish_listing.html [In reply to] Can't Post

Hi,

Thanks for the follow-up!

I have been looking this over but I'm not sure of a way that you could generate the error message if there are no map coordinates. Ross is actually more famaliar with Google maps then I am so what I'm going to do is pass this post over to Ross who may have some ideas that I had not thought of. :)

In the meantime if you have any other questions please feel free to ask.
Cheers,
Chet Woodside - Product Specialist
support@interactivetools.com

[hr][i][url "http://www.interactivetools.com/consulting/"][b]Hire me![/b][/url]
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with [url "http://www.interactivetools.com/consulting/"][b]Priority Consulting[/b][/url].[/i]


sammahoney
User

Jun 17, 2007, 8:13 AM

Post #4 of 6 (11637 views)
Shortcut
Re: [ChetW] Google map in _publish_listing.html [In reply to] Can't Post

Thanks. Is there maybe some way I could put that whole 'location tab' inside an 'IF' statement, so if the field for the coordinates is left blank then the tab isn't written?

Or maybe somewhere in the CSS for the tabs, using (display="none") or (display="block"?


(This post was edited by sammahoney on Jun 18, 2007, 7:22 AM)


ross
Staff / Moderator


Jun 18, 2007, 8:17 AM

Post #5 of 6 (11586 views)
Shortcut
Re: [sammahoney] Google map in _publish_listing.html [In reply to] Can't Post

Hi there.

I have to admit on this one that we are getting a little more advanced than I am used to so I don't exactly know how to get things going here.

Now, if you were interested, we could probably take closer look at this through consulting. I would say an hour would do it, so feel free to drop me an email through consulting@interactivetools.com Smile. I look forward to hearing from you.
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/



sammahoney
User

Jun 19, 2007, 10:49 AM

Post #6 of 6 (11545 views)
Shortcut
Re: [ross] Google map in _publish_listing.html [In reply to] Can't Post

I've somehow managed to get it to work. I was just gonna write above the map 'If you can't see a map there's no location details available' and when I wrote it in I found it only shows when there's no map! Don't know why but I don't really care so long as it works!

For anyone else looking to do the same thing:

<div id="tcontent3" class="tabcontent" align="center" style="width: 403px; height: 534px">
<span class="style1">There is currently no definite location information for this listing.</span>
<script>
// Grab the longitude and latitude for this listing
var longitude = getLongitude();
var latitude = getLatitude(); // these two functions are used so that listings with no coordinates don't break the map :).
function getLongitude()
{
return $lfield14$;
} function getLatitude()
{ return $lfield13$;
} var map = new GMap2(document.getElementById("tcontent3"));
map.addControl(new GLargeMapControl());
map.enableContinuousZoom();
map.addControl(new GScaleControl());
map.setCenter(new GLatLng($lfield13$,$lfield14$), 12, G_HYBRID_MAP);

// Create a marker whose info window displays the given number.
function createMarker(point, html) {
var marker = new GMarker(point); // Show this marker's index in the info window when it is clicked.

var output = html;
return marker;
} // the variable html is what will actually appear in the popup bubble. Make sure that any HTML you use here is XHTML strict
var html = "<div class='bubble_text'><table valign='top'><tr><td><img src='$listing_url$/images/$thumbnail$' width='$thumbnail_width$'></td><td valign='top' style='padding-top: 5px;'><b>REF: $lfield10$</b><br/><br/>$lfield11$<br/><br/> $lfield5$<br/><br/><font color='#656565' face='Tahoma' onclick=\"MM_openBrWindow('/listman/listings/$listing_file$','Advantage','scrollbars=yes, width=390,height=390')\"><a>Click <a href='javascript:;'>here</a> for more details</a></font></div>"; if (longitude && latitude !=null ) {
// the variable point is the longitude and latitude value of a listing. In this example, it is being passed from lfield8 and lfield9. You can use whatever fields you like though.
var point = new GPoint(longitude,latitude);
var marker = createMarker(point, html);
map.addOverlay(marker);
} //----------------------------------------------------------------------------
</script>
</div>