Google Maps Integration

Requests for additional features or modifications

Postby choovler » Sat Sep 01, 2007 10:52 am

Tried, but now nothing shows except >", so it's probably one quote off or something?

Chris
choovler
Advanced User
 
Posts: 194
Joined: Mon Jan 15, 2007 6:31 pm

Postby WagonTrader » Sat Sep 01, 2007 11:27 am

possibly... but I need to see 2 things to debug...

1) The snippet of code from the template file

2) The same snippet from the source view after being browsed.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Postby WagonTrader » Sat Sep 01, 2007 12:32 pm

Now that I think about it, there is an easier way to do all of this...

First, put back the changes done in the show.php file so that it is original.

Code: Select all
$map_link = "http://www.google.com/maps?q=".str_replace(" ","+",$vs_current_listing['loc1'])."+".$vs_current_listing['zip'];


Now I will show you how to add the markup only in the template file, I will do this in another thread to avoid confusion.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Postby choovler » Sat Sep 01, 2007 12:39 pm

Got it, back to original...
choovler
Advanced User
 
Posts: 194
Joined: Mon Jan 15, 2007 6:31 pm

Postby WagonTrader » Sat Sep 01, 2007 12:56 pm

Okay... the modification is here

http://phpdirectorysource.com/board/viewtopic.php?t=512

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Postby misholini » Wed Aug 12, 2009 5:04 am

WagonTrader wrote:Mapping outside of the united states does present some unique problems, namely for google it must have the country along with the province as you noted. If your country will always be New Zealand then this can be hard coded into the map link (no need for the additional field). Another approach to try would be to pass only the address1 field, which is the complete address, like this...

Code: Select all
      $map_link = "http://www.google.com/maps?q=".str_replace(" ","+",$vs_current_listing['address1']);


The question is will google be able to decipher the address... I don't know but it seems like it should.

Dave

I have integrated Google mapping in my listings,which works perfect, but the "Directions" button still bothers me as it reads only loc1 and defaults US. How can I implement the directions to read loc1 for for Ireland and N.Ireland?
misholini
User
 
Posts: 60
Joined: Sun Aug 02, 2009 7:53 am

Postby WagonTrader » Wed Aug 12, 2009 12:19 pm

I need to see the javascript you used to make it work on the map displayed on your site. This will give me the details that need to be included in the $map_link variable to pass the correct address info to google when user is redirected there from the directions link.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Re: Google Maps Integration

Postby misholini » Mon Dec 07, 2009 9:54 am

Hi Dave,
I have hard coded Ireland as a country.
In the sitehead.tpl:
var firm = "{$vs_current_listing.firmname}";
var address = "{$vs_current_listing.loc1}+{$vs_current_listing.xtra_1}+Ireland";
and in show.php:
$map_link = "http://google.com/maps?q=".str_replace(" ","+",$vs_current_listing['loc1'])."+".$vs_current_listing['xtra_1']."+". Ireland;

My question is as I cover the whole isle of Ireland, including Northern Ireland (UK), how could I show registered businesses located in N.Ireland. The Google map with API is blank and using the "Directions" button shows quite misguided map.
misholini
User
 
Posts: 60
Joined: Sun Aug 02, 2009 7:53 am

Re: Google Maps Integration

Postby WagonTrader » Tue Dec 08, 2009 2:58 am

I would start by going to google maps and searching for a valid address in Nothern Ireland. There will be a link tab that will show you the full link being used, you need to see what they are using for the q attribute. Also see if there is a localization variable (could be named anything) that specifies the area in the world they are searching.

Do the same thing for a valid address in Ireland and compare the two. We are looking for similarities that will work for both addresses. We may at some point need to store the locale and pass it along as well.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Re: Google Maps Integration

Postby misholini » Fri Dec 11, 2009 5:50 am

Hi Dave,
In fact my Google Maps with API MOD recognizes addresses in Northern Ireland (UK) nevertheless I have hard coded Ireland as a country in the sitehead.tpl. The problem is that the "Directions" button in show.php that loads Google maps without API will not tolerate that. If I change the last bit in the code below to UK, the map is all right.
$map_link = "http://google.com/maps?q=".str_replace(" ","+",$vs_current_listing['loc1'])."+".$vs_current_listing['xtra_1']."+". Ireland;

Addresses related to UK-Mainland (outside the isle of Ireland) do not show at all, neither on G.maps with API, nor on the one without API("Directions"). If I change Ireland to UK,then it's all ok, but then my listings from Ireland won't appear right on the maps. How could I fix this so listings from Ireland and UK appear on the maps?
misholini
User
 
Posts: 60
Joined: Sun Aug 02, 2009 7:53 am

Re: Google Maps Integration

Postby WagonTrader » Tue Dec 15, 2009 2:46 pm

The API has to submit the q variable, have you tried duplicating that formula for the map link? If the API link is using smarty variables {$vs_current_listing.key} then you will need to use the real variable in php... $vs_current_listing['key'].

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Re: Google Maps Integration

Postby misholini » Tue Dec 15, 2009 4:59 pm

I have made a change in the API, instead of hard coding the country I used the below smarty to call it:
{lang->desc p1='location' p2=$lang_set p3=$vs_loc_sel.0}
How can I do that in the map link (show.php)?
If I use the whole variable (without the curlies) then I get an error. I also tried calling the correct country as per listing with following :$vs_loc_sel['0']
but then I get the id not the title of the location from sql
misholini
User
 
Posts: 60
Joined: Sun Aug 02, 2009 7:53 am

Re: Google Maps Integration

Postby WagonTrader » Tue Dec 15, 2009 6:57 pm

It is using the language class, in php use...

Code: Select all
$var=$language->desc("location",$lang_set,$vs_loc_sel[0])


I have filled the $var variable with the value, just to simplify using it in the q varialbe.

Dave
User avatar
WagonTrader
Developer
 
Posts: 1946
Joined: Thu Aug 31, 2006 11:02 pm
Location: Oregon

Re: Google Maps Integration

Postby misholini » Wed Dec 16, 2009 12:47 pm

Thanks a million Dave!
misholini
User
 
Posts: 60
Joined: Sun Aug 02, 2009 7:53 am

Previous

Return to Mod Requests

Who is online

Users browsing this forum: No registered users and 1 guest