Active
Project:
Get Directions
Version:
7.x-3.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Dec 2011 at 18:04 UTC
Updated:
26 Oct 2013 at 15:59 UTC
Jump to comment: Most recent
Comments
Comment #1
hutch commentedUsing the Views module is probably the best way to get started, Getdirections will provide you with a View in a Block with a link to point to a Getdirections form and map.
You can't really put a link inside the location display, you would have to hack the Location module or possibly use a hook_form_alter function.
If your theme has an appropriate region that can take a block then you can do it there. The block will only appear when you are looking at the node.
Comment #2
LTech commentedThanks for the start - I would never have thought to look for that block. I've enabled the block but when you click on the links it just takes you to an empty page. with the title "Get directions to .... ".
How do I integrate the location field so I get directions to an address?
I'm finding the readme.txt difficult to get started with. Thanks for your help.
Comment #3
LTech commentedIt seems to be working fine now... though I don't think I made any changes. Does it take time to cache?
Thanks for getting me started.
Comment #4
LTech commentedbtw it is a really cool module! Thanks
Comment #5
hutch commentedComment #6
stevengraff commented"Using the Views module is probably the best way to get started, Getdirections will provide you with a View in a Block with a link to point to a Getdirections form and map"
Sorry, I'm a Drupal newb, still can't seem to get started. I don't see a getdirections block anywhere.
Can someone please assist with some spoonfeeding?
Thanks!
Comment #7
hutch commentedGo to the administration page for menu Navigation at admin/structure/menu/manage/navigation
Enable "Get Directions"
This will give you a link to the Getdirections map and form.
If you are using either Getlocations Fields or location modules and have created a content type with one of these attached to it and have created some nodes with locations associated with them you can use Views to create a view that will provide a link to a Getdirections map and form with the 'To' already filled in.
Install Views.
Go to the administration page for Views at admin/structure/views
Enable the getdirections view.
Go to the Blocks administration page at admin/structure/block and add the getdirections block to somewhere eg sidebar. The block will appear when you are on the node page.
Comment #8
stevengraff commentedThanks; that was helpful.
When I go to the list of menu links, the link for Get Directions seems to work, i.e. it shows me a fresh page with a map and form on it, but activating and placing the block into a section (i.e. content) doesn't seem to do anything at all -- it does not appear.
Comment #9
hutch commentedThe content has to have either a Getlocations Fields or a location field enabled and filled in. That is where the 'To' address will come from.
Install Getlocations (read the instructions on the project page), enable the Getlocations Fields module, configure both under Configuration > Web services, create a new content type under Structure > Content types (name it 'With Address' for instance) and add a field 'Getlocations Fields'. Configure that and save.
This will give you a content type with a map and address form. Create some nodes of this type, filling in the address. Google will geocode the address and you will have a latitude and longitude for that address. Once you have that the rest will fall into place.
You could also use the Location module but in my opinion Getlocations is better, but then I wrote it so I would say that ;-)
Comment #10
stevengraff commentedThanks; when I enable the Getlocations module I get:
Error message
Getlocations is unable to save the marker configuration, so the markers will not work. Please check file system permissions of sites/default/files/js/getlocations_markers.js!
Any idea what might cause this?
Comment #11
hutch commentedHave you regenerated the marker cache under 'admin/config/services/getlocations'?
If that is what caused the message you need to do what the message says:
check file system permissions of sites/default/files which should be writeable by anyone eg 777.
I am assuming that you have followed the instructions on the Getlocations project page and installed some markers in sites/all/libraries.
Comment #12
stevengraff commented"I am assuming that you have followed the instructions on the Getlocations project page"
You mean the bit that says:
"Important:
Please read and follow the instructions in README.txt. You need to do this to get markers working. You will need at least the first one in the lists below."
Of course not! :) I'll do that today. Thanks again.
Comment #13
stevengraff commentedWell, weirdly enough, I can manually set the permissions to 777, but when I try to enable Get Locations, I get the failure message and the permissions revert to 775.
OK; I've gotten the permissions to "stick" at 777, but the file getlocations_markers.js is nowhere to be found.
Comment #14
stevengraff commentedI manually created an empty file called getlocations_markers.js and uploaded it into the js directory. Upon updating Drupal, the file got "populated" with script and is now 4kb in size. When I disable/enable getlocations now I get a success message rather than the error message. Thus I am now past this particular impediment.
I rechecked permissions on the js directory, and they are still 777. I would say this problem warrants further investigation aside from the fact that no one else seems to have experienced it, so perhaps it's just related to something else off-kilter in my site configuration or permissions.
Comment #15
gpenn commentedHutch, Thanks for this great module. We Drupal newbies really appreciate it. But there's something I can't figure out (did I mention I'm a newbie?).
1. I installed Getdirections and Location.
2. I created a page and associated it with a location.
3. I linked (in a menu) to that page from my front page.
4. I placed the Getdirections block on that page.
The block links to yet another page that works perfectly (with the destination already chosen and the map and form at the ready). But is there someway to arrive at that perfectly working page directly from my menu link, without going through the middle page? I tried placing the block on my front page, but it didn't even appear. I'm guessing that's because there's no location associated with the front page. How would one associate a location with a front page? Or can one create a Getdirections block that shows the final map and form without having to click through another link?
From my searches, I notice that many solutions to folks' issues involve PHP code. I'm happy to insert some, but because of my newbieness, I'll need to know exactly where it goes.
Thanks in advance for your help.
Comment #16
gpenn commentedAnd, since I'm asking basic questions, how can I pre-fill the "Country" box in the "from" address so that people don't have to select USA each time?
Comment #17
hutch commentedThe block is designed to show up when you are on a page/node that is location enabled, providing a link to the getdirections map on how to get there. If you want a link to the getdirections map without anything filled in already, create a menu item '/getdirections'
If you want the home page location enable use a content type that is location enabled for the home page.
You might want to try the Getlocations module, it has a submodule Getlocations Fields that is a replacement for the Location module with full support for Google version 3 maps.
As always, read the README.txt files ;-)
To set the default country, go to admin > configuration > Regional and language > Regional settings.
Comment #18
gpenn commentedThanks, Hutch, for the push in the right direction. Unfortunately, advanced developers like you and README files often assume knowledge that the interlocutor/reader simply doesn't have. For instance, the Getdirections README file explains: "if you want to "preload" the getdirections form with information about the destination use a URL in this format: getdirections/location/to/99 where '99' is the node id (nid) of the location." But it doesn't say how to use that URL. It finally dawned on me that I could create a menu item and assign it to that path. I know this seems beyond simple to you, but for those of us out here who love what Drupal can do but haven't any expertise, these small connecting pieces of information help vastly.
So, for others like me who are in charge of a small site (a church, in my case) and need a simple link on the homepage to a getdirections form and map with the "to" box already filled in with the location of your organization/business/church, here are the steps (in Drupal 7):
You’re done! Go to your homepage, find the new menu link, click on it, and—if all goes well—you should be brought to a page that has the Getdirections form with the “to” information already there and a map with your place smack-dab in the center.
Try it. Type in a Starting from address, submit, and you’ll see how wonderful Hutch’s module is.
PS: I still get the “from” country box without my site’s default (USA) showing, but it seems that the system knows what the default is. So I used a bit of CSS magic to make that box disappear.
Comment #19
hutch commentedThe Location module has it's own default country setting and Getdirections uses that when you are using the Location module.
Comment #20
gpenn commentedThanks. I had already set the Location module default country to US, and I believe the logic recognizes that, but I still get "Please select" in the Country box. But no matter, as I've hidden that box from view.
I do have another question, though: is there some way to set the traffic and bicycling info toggle switches to off in their first state. As it is now, the map opens and automatically loads the traffic/bike info, and the user has to toggle them off. I'd prefer that the map load clean, and the user would have to toggle the information on. Possible?
Thanks.
Comment #21
hutch commentedThere is no facility for setting this is admin/config/getdirections, but you could do it in whatever javascript file you are using (look in the html source to see which one).
I might add this to the code at some time, I'm rather busy at the moment.
Comment #22
hutch commentedThe latest dev has an "Activate" option for all the buttons, traffic, transit, bicycle, panoramio, weather and cloud, so now you can have the button enabled but not applied to the map on initial view.
Available with git or later tonight.
EDIT: oops this only applies to the Getlocations module as yet, sorry about that.
Comment #23
dharam1987 commentedNo doubt, it is a great module, but I have got a requirement and is wondering how make use of getdirections as a block in my page, which is a view that is displaying the map using gmap module, I would like the block to show the form and upon clicking get directions, it shouldn't redirect the user to a new page, it should stay on the same and and display the directions.
What I have done.
1- I have gmap module and location module aswell
2- I have a content type where I am adding the locations, latitude and longitude
3- Now, I have created a view to display the map, My view is using the format (GMAP). The map is coming perfectly.
4- Now, I want to have get directions form in this page, and even if the page refresh happens, it should always display this page and use this map.
http://goo.gl/r4Or7 is the URL where the view is display google map using GMAP (format).
I am sure this setting might be there somewhere, but I am not getting it. After doing more-experiments, I would love to create a documentation with use-cases of get-directions module.
Comment #24
hutch commentedThis will not be simple, but is probably doable.
First, getting the form into your page. To do that you will probably need some PHP in your page which will fetch, render and theme the form. See the bottom of function getdirections_direction() for some hints. You can import the theme 'getdirections_show' into your theme's template.php and edit that to prevent a map div from being created.
You will need to ensure that the Getdirections settings are being loaded into CDATA. function getdirections_direction() will show you how.
You will need to use your own version of getdirections_v2.js or getdirections_v2a.js, you can set this in admin > config > getdirections at the bottom of the form.
Your version will need to be told which map is being used, prevent the default map from being created but still ensure that the other actions work on your map. I don't know wether Gmap makes the map object globally available so that you can act on it.
Comment #25
jamesbenison commentedCreate a custom block. Use the php filter for the content. Then paste this into your block content:
I think that will do what you're looking for.
Edit: You will need to have the php filter module enabled.
Comment #26
lias commentedThanks for the code. This worked for Geofield and Addressfield.
Comment #27
hutch commentedI will be adding #25 to the README.txt, nice clean and simple, no Views overhead.
Comment #28
peacog commentedThank you for the excellent module. I've been trying out version 3.x and see that the getdirections_setlocation() function is no longer available. What's the correct way to put the map in a block in 3.x?
Comment #29
hutch commentedTry something like
This assumes your target is a node.
Comment #30
screeno commentedAfter adding the block as described in #25 above, I get a WSOD when I go to a page that uses the script. The log shows the following:
Notice: Undefined variable: nid in eval() (line 2 of /Applications/MAMP/htdocs//modules/php/php.module(80) : eval()'d code).
Any idea why this is happening?
Here's an update to this post. I swapped out the code with the following as per the readme:
I am still getting a white screen but am no longer getting any log message related to the script. I know the code in the block is capturing the nid because I modified the code to print out the nid and it shows the correct nid.
Comment #31
hutch commentedThe function getdirections_setlocation() does not exist in 7.x-3.x, my bad, I did not update the README when I created the 3.x series.
This also checks if the node is location enabled.
Comment #32
screeno commentedFantastic! This worked beautifully. One other small item. When the page first loads and the from field has not been filled in the form, an empty table is displayed below the from field. How do I hide that table until the form is processed?
Thanks for this very helpful module.
Comment #33
hutch commentedHmm, I don't see a table, are you seeing the map with the "to" location marked with a marker?
Comment #34
joco_sp commented#31 worked.
Is there a way to have both fields filled with values from the field 'to' and 'from'? and get the route automaticly from one location to another?
Comment #35
hutch commentedHave a look at function getdirections_entity_setlocations()