The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 26 posts ] 
Author Message
PostPosted: Mon Jan 04, 2010 2:25 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 08, 2007 6:00 pm
Posts: 123
Location: Aarhus (Denmark)
For everybody that want integrate google maps into contact form.

1) Download and install Google maps plugin from http://extensions.joomla.org/extensions/1147/details
2) Generate the API key for use the Google maps plugins in http://code.google.com/intl/gl/apis/maps/signup.html
3) Add the API key in the plugin configuration and activate the plugin
4) Open the file administrator/components/com_contact/contact_items.xml and after this line:
Code:
<param name="allow_vcard" type="radio" default="0" label="vCard" description="Show/Hide VCard">
         <option value="0">Hide</option>
         <option value="1">Show</option>
      </param>

Add this 3 lines:
Code:
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="lat" type="text" defautl="" label="Latitud" description="Latitud en el mapa" />
<param name="lon" type="text" defautl="" label="Longitud" description="Longitud en el mapa" />


5) Copy the file components/com_contact/views/contact/tmpl/default_address.php to /templates/[your current template]/html/com_contact/contact/ (If the directories tree don't exist you must creat it)
6) Open the copied file /templates/[your current template]/html/com_contact/contact/default_address.php and add to end of file the next piece of code:

Code:
<?php
  if ( $this->contact->params->get('lat')!='' && $this->contact->params->get('lon')!='' ) {
   
    echo '<div class="mosmap">';
   
    $mosmap = &JTable::getInstance('contact');
    $mosmap->text="{mosmap lat='".$this->contact->params->get('lat')."'|lon='".$this->contact->params->get('lon')."'|height='200px'|width='100%'}";
    $dispatcher =& JDispatcher::getInstance();
    $params = & new JParameter('');
 
    JPluginHelper::importPlugin('content');
    $results = $dispatcher->trigger('onPrepareContent', array (& $mosmap, & $params, 0));
   
    echo $mosmap->text;
   
    echo '</div>';             
  }
?>


Now you can add a contact position directly from the contact form!! :pop

Attachment:
screen.png


You do not have the required permissions to view the files attached to this post.

_________________
From the code to the reality!


Top
 Profile  
 
PostPosted: Mon Jan 04, 2010 5:46 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Nov 24, 2009 10:44 pm
Posts: 16
Nice tip. Many thanks

_________________
Jocuri Online Sport Gratuite - http://www.curteascolii.ro

Signature rules: Literal URLs only - viewtopic.php?f=8&t=65


Top
 Profile  
 
PostPosted: Mon Jan 18, 2010 1:36 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon Jan 18, 2010 1:04 pm
Posts: 1
I've made the changes to the files, and the options to add Longitude and Latitude appears like in the screenshot, but when I save it, it doesn't appear on the website itself.

page: http://www.ruthministries.co.za/index.p ... &Itemid=58

Any help would be really appreciated!


Top
 Profile  
 
PostPosted: Mon Jan 18, 2010 4:45 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 08, 2007 6:00 pm
Posts: 123
Location: Aarhus (Denmark)
Have you been activate the gmaps plugin?

You can see an example of the contact form with map in:
http://www.vallegranrey.es/turismo/es/informacion-util/puntos-de-informacion/36-informacion/240-oficina-municipal-de-turismo.html

_________________
From the code to the reality!


Top
 Profile  
 
PostPosted: Fri Jan 22, 2010 1:28 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat May 30, 2009 12:42 pm
Posts: 17
Hi:
I follow all the instructions, but I don't see any map in the contact form.
I have a question, the plugin will take country and street from the contact form?
which field do I need to complete in the plugin, API key, what else?

I have multiple contact forms....


Top
 Profile  
 
PostPosted: Fri Jan 22, 2010 8:48 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 08, 2007 6:00 pm
Posts: 123
Location: Aarhus (Denmark)
You must activate the plugin and insert an api key from http://code.google.com/intl/es-ES/apis/maps/signup.html.

You must indicate the latitude and longitude in the new form fields (you have an example in previous post with a image).

_________________
From the code to the reality!


Top
 Profile  
 
PostPosted: Fri Jan 22, 2010 9:19 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat May 30, 2009 12:42 pm
Posts: 17
The pligin is activated, the API is withing the plugin configuration.
The issue is that I don't receive a new format, with the latitude and longitude.


Top
 Profile  
 
PostPosted: Fri Jan 22, 2010 10:42 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat May 30, 2009 12:42 pm
Posts: 17
I already fixed my issue, I received in the contact form both fields.
But now when I try to open the contact form I received:
Table class JTableContact not found in file
What I need to do?


Top
 Profile  
 
PostPosted: Fri Feb 19, 2010 6:54 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Jan 23, 2010 10:01 am
Posts: 3
Me too...
I get
Table class JTableContact not found in file

Come on whizz kids.. help an old man out


Top
 Profile  
 
PostPosted: Tue Feb 23, 2010 9:32 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 08, 2007 6:00 pm
Posts: 123
Location: Aarhus (Denmark)
Ok,

I have the solution.

Replace:

Code:
$mosmap = &JTable::getInstance('contact');


for

Code:
$mosmap = new JObject();

_________________
From the code to the reality!


Top
 Profile  
 
PostPosted: Tue Feb 23, 2010 9:58 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Jan 23, 2010 10:01 am
Posts: 3
Cheers. That works great


Top
 Profile  
 
PostPosted: Thu Apr 22, 2010 6:33 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Apr 22, 2010 6:23 pm
Posts: 3
Thanks for your work

this is other method of plugin author:

http://tech.reumer.net/Google-Maps/Docu ... 1.5.x.html


Top
 Profile  
 
PostPosted: Fri Jul 23, 2010 11:59 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 08, 2007 6:00 pm
Posts: 123
Location: Aarhus (Denmark)
Some persons report me a problems with PHP 5.3 and other issues

Here is the last version:

For everybody that want integrate google maps into contact form (Last version).

1) Download and install Google maps plugin from http://extensions.joomla.org/extensions/1147/details
2) Generate the API key for use the Google maps plugins in http://code.google.com/intl/gl/apis/maps/signup.html
3) Add the API key in the plugin configuration and activate the plugin
4) Open the file administrator/components/com_contact/contact_items.xml and after this line:
Code:
<param name="allow_vcard" type="radio" default="0" label="vCard" description="Show/Hide VCard">
<option value="0">Hide</option>
<option value="1">Show</option>
</param>

Add this 3 lines:
Code:
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="lat" type="text" defautl="" label="Latitud" description="Latitud en el mapa" />
<param name="lon" type="text" defautl="" label="Longitud" description="Longitud en el mapa" />


5) Copy the file components/com_contact/views/contact/tmpl/default_address.php to /templates/[your current template]/html/com_contact/contact/ (If the directories tree don't exist you must creat it)
6) Open the copied file /templates/[your current template]/html/com_contact/contact/default_address.php and add to end of file the next piece of code:

Code:
Code:
<?php
  if ( $this->contact->params->get('lat')!='' && $this->contact->params->get('lon')!='' ) {
   
    echo '<div class="mosmap">';
   
    $mosmap = new JObject();
    $mosmap->text="{mosmap lat='".$this->contact->params->get('lat')."'|lon='".$this->contact->params->get('lon')."'|height='200px'|width='100%'}";
    $dispatcher =& JDispatcher::getInstance();
    $params = new JParameter('');
 
    JPluginHelper::importPlugin('content');
    $results = $dispatcher->trigger('onPrepareContent', array (& $mosmap, & $params, 0));
   
    echo $mosmap->text;
   
    echo '</div>';             
  }
?>


Now you can add a contact position directly from the contact form!! :pop

Image

_________________
From the code to the reality!


Top
 Profile  
 
PostPosted: Thu Dec 23, 2010 10:51 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Aug 28, 2008 8:15 am
Posts: 192
Could someone post a way that we can place the map below the contact image?

I saw that the code is at the mytemplate/html/contact/default.php and i try to write some code with no success.

The reason is because if you want to have an email form and the map then the webpage gets too long.

Thanks in advance


Top
 Profile  
 
PostPosted: Mon Jan 10, 2011 10:08 am 
Joomla! Intern
Joomla! Intern

Joined: Thu Dec 30, 2010 7:01 am
Posts: 56
Can somebody pse tell me...where on earth do I find the file that the above refers to ie. administrator/components/com_contact/contact_items.xml ??


Top
 Profile  
 
PostPosted: Fri Jan 28, 2011 9:20 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Jan 28, 2011 9:10 am
Posts: 1
hey i am also suffering with the same problem:

"Table class JTableContact not found in file."
please help me out.
i eaven tried
$mosmap = &JTable::getInstance('contact');
instead of
$mosmap = new JObject();
but still getting the same problem..
please help me out asap


Top
 Profile  
 
PostPosted: Mon Apr 25, 2011 1:23 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Jan 03, 2009 1:09 pm
Posts: 11
Works fine for me, but I do have problems with using the contact image. It creates a lot of space between the title and the different contact labels. Is there any solution for it?


Top
 Profile  
 
PostPosted: Mon Apr 25, 2011 3:44 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 08, 2007 6:00 pm
Posts: 123
Location: Aarhus (Denmark)
Override the contact template or edit the CSS

_________________
From the code to the reality!


Top
 Profile  
 
PostPosted: Sat May 28, 2011 11:02 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Aug 28, 2008 8:15 am
Posts: 192
How can we change the get directions language text on google maps using joomfish?


Top
 Profile  
 
PostPosted: Sun May 29, 2011 11:18 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Nov 08, 2007 6:00 pm
Posts: 123
Location: Aarhus (Denmark)
You can't!

You must access to the gmaps plugin options and there you can translate some texts like "Get Directions", "Address", etc.

_________________
From the code to the reality!


Top
 Profile  
 
PostPosted: Sun Jul 24, 2011 11:24 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jul 01, 2009 7:27 pm
Posts: 11
Location: Drniš, Croatia
Does anybody knows how to make this hack work on joomla 1.6/1.7, I made new topic in "Joomla! 1.7 / 1.6 Coding" viewtopic.php?f=642&t=638757.


Top
 Profile  
 
PostPosted: Fri Aug 26, 2011 10:46 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Aug 26, 2011 10:40 am
Posts: 2
Nice tip. Many thanks


Top
 Profile  
 
PostPosted: Fri Aug 26, 2011 1:20 pm 
I've been banned!

Joined: Wed Aug 03, 2011 1:02 pm
Posts: 26
Works fine for me thank you very much


Top
 Profile  
 
PostPosted: Fri Sep 30, 2011 6:39 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Sep 30, 2011 6:36 am
Posts: 2
Oh. Many thanks for sharing such a good and useful information. That helped me to make my problem fixed!!!


Top
 Profile  
 
PostPosted: Wed Dec 05, 2012 11:05 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Sep 30, 2010 8:14 pm
Posts: 2
Thank you so much for the help!!!

I don't know what was the problem but I had to remove the if condition in order to show the map.

But worked like a charm.

Thanks again. :D


Top
 Profile  
 
PostPosted: Sat Jun 22, 2013 5:44 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Jul 24, 2010 1:59 pm
Posts: 3
Thank you. Nice tip.

_________________
Sursa ta de jocuri bune! - http://www.gameway.ro


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 26 posts ] 



Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group