Map Link Doesn't show up - phone problem also fixed

jriedel - December 13, 2008 - 20:36
Project:Location
Version:6.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:location bdragon check
Description

Just upgraded from the last RC to 6.x-3.0. The map link was not showing up no matter what I did.

I traced it down to these lines in location.module

<?php
 
// Map link.
 
$variables['map_link'] = '';

  if (isset(
$variables['hide']['map_link']) && !$variables['hide']['map_link']) {
   
$variables['map_link'] = location_map_link($location);
  }
?>

If variables['hide']['map_link'] is not set, meaning show the map link, then the test is false and the call is to location_map_link is never made.

#1

jriedel - December 13, 2008 - 20:50

I just checked something else and the phone information doesn't show up, you have achoice to make it show or not and if I edit the node I see the saved phone information, but you never see it.

#2

jmai - December 16, 2008 - 08:24

I changed the if statement to

if (!$variables['hide']['map_link']) {

and it worked.

#3

fletch11 - December 19, 2008 - 13:35

When I make this substitution I just get the white screen. Does anyone have any more suggestions or a more descriptive example?

thanks

#4

JDM843 - December 20, 2008 - 18:32

I had this same problem in 5.x-3.0. Fix in #2 worked for me as well.

#5

keyone - December 20, 2008 - 18:53

The fix in #2 did nothing for me. I even went so far as to change the code to always call the location_map_link function, and still no map links showing up. I can't see where to fix the phone number problem.


// Map link.
  //$variables['map_link'] = '';
  //  if (isset($variables['hide']['map_link']) && !$variables['hide']['map_link']) {
// if (!$variables['hide']['map_link']) {
    $variables['map_link'] = location_map_link($location);
// }

#6

keyone - December 20, 2008 - 18:55

fletch11...You probably left out the other curly bracket. White screen means error. Change it to look like this (I commented out the first if statement, and replaced it with the new one. (this did not work for me, btw)

  // Map link.
  //$variables['map_link'] = '';
  //  if (isset($variables['hide']['map_link']) && !$variables['hide']['map_link']) {
  if (!$variables['hide']['map_link']) {
    $variables['map_link'] = location_map_link($location);
  }

#7

jriedel - December 20, 2008 - 19:09

I fixed it for now by commenting out the if and always making the call to location_map_link

#8

keyone - December 20, 2008 - 20:35

I did fix this problem using the instructions in Comment #2. One important note. You cannot have the location field "Country Name" hidden in the Content Type > Locative > Display Fields settings, or it won't show map links. That is a requirement of looking up the map. Now, I am trying to debug the phone number problem!

#9

keyone - December 20, 2008 - 21:06
Title:Map Link Doesn't show up» Map Link Doesn't show up - phone problem also fixed

I figured out how to fix the phone problem.

In location.tpl.php, near line 28, after this piece of code where it's printing the country...

<?php if ($country_name) { ?>
<div class="country-name"><?php echo $country_name; ?></div>
<?php } ?>

Add this, so it prints out the phone number:

<?php if ($phone) { ?>
<div class="phone"><?php echo $phone; ?></div>
<?php } ?>

#10

SocialNicheGuru - December 20, 2008 - 22:28

subscribing.. great fixes

#11

SocialNicheGuru - December 20, 2008 - 22:52
Status:active» reviewed & tested by the community

This works for 5x.3.0 too.
please commit changes

#12

jriedel - December 24, 2008 - 02:05

Don't know if this should be a new issue or not.

I was just starting to set some things up with the user locations. Working OK. Then someone looking over my shoulder said, "You know just a list a can print out of names, addersses and phone numbers would be cool."

I said, "Watch this." as I enabled the user-Location view, but when I went to tweak that view I found out the Phone number field is not in the view. It can not even be picked from one of the location fields.

So somehow when the phone sub-module is enabled, it has to tell views that phone is field it can use.

I started to look a bit at it, but I don't understand the views API at this to even know where to start.

#13

pathfinderelite - December 29, 2008 - 22:47
Status:reviewed & tested by the community» needs review

The missing map link problem exists for the location-5.x-3-0 as well. For me, the patch given in #2 does not work properly, It does show the map link successfully, but the opposite problem now exists. The map link is always shown, despite the display settings. This is because the $variables['hide'] array has numerical indexes, with the values being the name of the field to hide. So, instead of checking if $variables['hide']['map_link'] exists, we need to check if the value 'map_link' is in the array $variables['hide'] - a subtle difference. A patch is attached.

AttachmentSize
location-346694-13.patch 430 bytes

#14

pathfinderelite - December 29, 2008 - 23:53

If the above patch does not work for you, try this one. I had some issues by not doing a strict in_array comparison in the previous patch. Here is an updated patch.

AttachmentSize
location-346694-14.patch 436 bytes

#15

dustonio - January 18, 2009 - 07:00

I applied the patch #14 and it works for me; thanks! I previously was unable to get the "See Map" and the Google Maps link to show until I applied the patch. I am using Drupal 6.9.

#16

rootwork - January 19, 2009 - 09:34
Version:6.x-3.0» 6.x-3.x-dev

I started with 6.x-3.0 on D6.9. Similar to the original poster I couldn't ever get the map link to appear. Made sure all the permissions were set and a map link provider was checked in location settings.

Then I upgraded to the most recent 6.x-3.x-dev. Still no map link. Tried both of the patches, in #13 and #14, and they don't seem to make a difference, at least for me (I'm jealous of dustonio!). Turned off all caching and cleared stuff just to be sure, each time.

I've actually never seen the map link, so I'm not sure exactly what it's supposed to look like, but there's certainly nothing that would resemble such a thing being displayed.

There's so much that's fantastic about this module, and I love it...but the mythical map link does sound like a nice feature. :)

#17

fletch11 - January 19, 2009 - 17:46

Hi quixoticlife:

in collection settings of your content type have you allowed the collection of countries? This assumes you are using cck, but the map link does not work if country info is not collected or force defaulted.

#18

rootwork - January 19, 2009 - 17:59

Interesting! I figured it wouldn't work if it wasn't collected, but I didn't guess that it would fail with force-default.

Nonetheless, after setting all fields to "Allow," I still don't see a map link. Three of the fields (city, state, country) have defaults -- would that disable the link?

#19

fletch11 - January 20, 2009 - 12:41

Sorry, I meant to say that it should work if the country field is set to 'force default' but won't if a country is not collected altogether. Can't say I know what would cause this if you've tried setting all fields to 'Allow' and manually entered valid locations in each field. This patch seemed to work for me after trying a lot of things. Have you modified your .tpl.php file for the node type? Also I found that using contemplate required the addition of custom code and that otherwise the link wouldn't show up.

#20

rootwork - January 21, 2009 - 05:24

Which patch worked for you, #13 or #14? I haven't created a .tpl.php file for the content type, and node.tpl.php, while slightly modified, is still displaying the straight $content value. I'm not using contemplate.

#21

fletch11 - January 22, 2009 - 15:25

#14 worked for me... not sure what else to try - you might want to test another theme or disable all unneccessary modules to see if you get a response.

#22

FoolsRun - January 24, 2009 - 14:46

I can confirm the phone number display problem, I can also confirm that adding the code from commen #9 fixes it. This should definitely be committed. bdragon?

#23

jriedel - January 24, 2009 - 16:57

Can anyone else confirm that the phone number field doesn't show up as a field to choose in Views?

Try creating a new view and phone number is not listed to pick from to display.

#24

KarenS - January 27, 2009 - 18:02
Status:needs review» reviewed & tested by the community

The patch in #14 makes the map link show up. I don't use the phone number so can't confirm anything about that. If this doesn't fix the phone number, I think that is a separate issue, because the failure of the map link to display is clearly the incorrect logic that is fixed by #14.

#25

bdragon - February 10, 2009 - 17:17

Confirmed #14 patch.

Committed something a bit different, because I figure it will be slightly more efficient than in_array.

http://drupal.org/cvs?commit=170589
http://drupal.org/cvs?commit=170591
http://drupal.org/cvs?commit=170593

#26

bdragon - February 10, 2009 - 17:22

Regarding the phone problem, I've been running with this patch for a while. Does anyone have any +1s or -1s for it?

AttachmentSize
location.tpl_.php_.patch 634 bytes

#27

skyredwang - February 10, 2009 - 20:14

#26 would be better if using instead of . Just for consistency.

#28

davea - February 22, 2009 - 12:36

#14 works so now the Google maps links displays.

Thanks!
DaveA

#29

drizzi - March 7, 2009 - 21:54

still have the same effect.. updated to the last dev and even have problems to find the equivalent program code in order to change.

is there any better explanation available or will the downloadable code updated soon ? i urgently need the location including a functional gmap.

the phone and fax stuff is working; the map shows up while editing and disappears while in "normal" homepage made.

any quick help is appriciated.

steffen

edit: found "Then, make sure permissions on "files," "files/js" and "files/js/gmap_markers.js" are set to 777 - that's working for me - so far, anyway." this solved my problem.

#30

Matt V. - March 17, 2009 - 06:40

The patch in #26 works, but could use a bit of formatting cleanup. There is no space between the field label and the field.

#31

aaronbauman - March 27, 2009 - 04:09
Status:reviewed & tested by the community» needs work

Map Link disappears from display when "Country" (not to be confused with "Country Name") checkbox is checked.

Appears fine if "Country" checkbox (and "Map Link" checkbox) is left unchecked.

#32

seanr - April 10, 2009 - 21:02

Confirmed #31. Definitely something screwy with these checkboxes. I'd bet it's just a typo somewhere.

#33

YesCT - April 16, 2009 - 11:25

#34

seanr - April 20, 2009 - 17:53

Same bug exists in 5.x

#35

macrocosm - April 28, 2009 - 05:40

I can confirm that the dev version fixes the issue.
For some reason the last time I ran drush updates it installed the 3.0 version. Should that one really be the recommended version with all those bugs? At any rate I am sooo excited that the dev version is a happy camper! Thanks for the fixes!

#36

YesCT - May 1, 2009 - 13:45
Status:needs work» fixed

#37

YesCT - May 1, 2009 - 13:47

Hmmm was the patch in #26 included in the dev release?

#38

System Message - May 15, 2009 - 13:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#39

dhartman - June 13, 2009 - 04:17
Status:closed» active

Patch in #26 doesn't appear to be committed in 6.x-3.x-dev. Also, I can confirm that the bug in #31 still exists in dev from today (6-12-2009).

#40

seanr - June 22, 2009 - 20:27

Same. Can we please get this in an RC release too?

#41

sandino - July 10, 2009 - 03:26

Applied patch #26 and it works for me with 3.1-rc1.

#42

YesCT - July 6, 2009 - 11:23
Status:active» needs work

#43

YesCT - July 10, 2009 - 06:58

@skyredwang in #27 I think you posted some HTML we can't see. Please repost.

Formatting mentioned in #30

and

Checkbox problem in #31

Need addressed.

Someone needs to address those and re-roll this againt head.

The cvs checkout command is on the location project page [edit: http://drupal.org/project/location] under a deveopler tab [edit: it's actually called CVS Instructions]. And google for:
drupal apply patch
and
drupal create patch
if you (someone) wants to take a stab at this.

If anyone needs help making the re-roll patch post back here or try #drupal-geo for help on irc

#44

bomarmonk - August 4, 2009 - 21:21

Has this fix been committed? No map links display for me.

#45

skyredwang - August 5, 2009 - 13:35
Status:needs work» fixed

Yes. the fix has been committed.

#46

System Message - August 19, 2009 - 13:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.