joomla_estate_agencyJoomla Estate Agency is an excellent real estate component for joomla. After using it for several sites and spending some time in the support forum I noticed there seemed to be some confusion on how to edit the property contact forms.

So here is how to do it....

For the purpose of this tutorial we're going to hide the subject box while still sending the reference, and add some date enquiry boxes.

Editing the Form

The first file we need to edit is the contact form it's self. This is located in

 /components/com_jea/views/properties/tmpl/default_item.php

The form code starts around line 160 with the line

<form action="&lt;?php echo $this->getViewUrl ($this->row->id,'&task=sendmail' ) ?>" method="post" enctype="application/x-www-form-urlencoded"&gt;

To hide the subject (The subject is the title of the property which the sender already knows so doesn't really need to be seen, just sent) Look for the following line:

<input type="text" name="subject" id="subject" value="Ref : &lt;?php echo $this->escape( $this->row->ref ) ?&gt;" size="40" />

and replace it with the following to change the input type to "hidden"

<input type="hidden" name="subject" id="subject" value="Ref : &lt;?php echo $this->escape( $this->row->ref ) ?&gt;" size="40" />

To add a new field we can basically copy another and give it a unique id. I'm going to add 2 new fields for reservation dates using the id's "from" and "to" using the following lines:

<p><label for="from">&lt;?php echo JText::_('From') ?> :</label> <input type="text" name="from" id="from" value="dd/mm/yyyy" &lt;?php echo JRequest::getVar('from', '') ?> size="10" maxlength="10"> </p>

<p><label for="to">&lt;?php echo JText::_('To') ?> :</label> <input type="text" name="to" id="to" value="dd/mm/yyyy" &lt;?php echo JRequest::getVar('to', '') ?> size="10" maxlength="10"> </p>

If you want the label to be translateable you need to include the php echo JText part. Then in the language files for the component (/language/en-GB/en-GB.com_jea.ini or fr-FR/fr-FR.com_jea.ini) you add the translation for each language like this

FROM=text I want to display for this language for the word from

Now that we have the new fields in the form we need to put the new information into the email.

Edit the Email Information

The file responsible for sending the email is:

/components/com_jea/controllers/properties.php

The sendmail function starts around line 165 with the line:

function sendmail()

We first need to add our variables from the form, so scroll down to

JRequest::setVar('name' , '');
JRequest::setVar('subject', '');
JRequest::setVar('email', '');

and add the lines for our new fields:

JRequest::setVar('from' , '');
JRequest::setVar('to' , '');

Scroll back up to the mail form and we can add the new fields to the email. I'm going to add them to the subject but the same thing applies if you want to add the information to the main email. The line we are going to edit is:

$subject = JRequest::getVar('subject', '') . ' [' .$config->getValue('fromname', '') . ']';

I'm going to add some fixed text aswell to make the subject more readable.

$subject =  ' [' .$config->getValue('fromname', '') .']' . JRequest::getVar('subject', '') . "   From: " . JRequest::getVar('from', '') . "   To: " . JRequest::getVar('to', '');

Now, when the form is sent, the email will have the subject as

[SiteName] John Doe Ref:PropertyName  From:12/12/2010  To:24/12/2012

 

 

Category: Joomla

Newsletter Signup

Latest Posts

Google+ Timeline Feed for your Website Google+ Timeline Feed for your Website 2012-05-11 - I was asked earlier today to create a Google+ widget for a website to replace a twitt... More detail
Run Facebook Messenger on Windows Vista Run Facebook Messenger on Windows Vista 2012-04-19 - Facebook has just released it's new messenger for windows but it only runs on Windo... More detail
Translate K2store Product Attributes with Joomfish Translate K2store Product Attributes with Joomfish 2011-11-03 - If you have a K2store and your site is in multiple languages, you might have found th... More detail
French Translations for K2store French Translations for K2store 2011-11-02 - I have been working recently with the K2 component/plugin K2store. As a simple sho... More detail
How I Upgraded to Joomla 1.7 How I Upgraded to Joomla 1.7 2011-09-25 - Inspired by Robert Vining over at www.joomstew.com and the fact that I am building mo... More detail

Twitter Stuff