فتحات العرب Joomla! • Index page: Extensions for Joomla! 3.x • Re: Add fields to contact email form (Joomla 3.0)

Wednesday, January 1, 2014

Extensions for Joomla! 3.x • Re: Add fields to contact email form (Joomla 3.0)

Ok, well I've narrowed it down and actually I think I've been editing the correct files, just not correctly somehow.



My template has the 2 files:

public_html/components/com_contact/models/forms/contact.xml

and

public_html/components/com_contact/views/contact/tmpl/default_form.php



within the html file under my specific template folder.

These seem to be the ones you edit to SHOW the fields in the contact form.



To get it to send all the field info, I think you need to edit the contact.php file which in my case was not in the template contact folder, it seems to be still under components/com_contact/controllers/contact.php



I had already edited from line 155 to add the additional fields, just following the format of the original fields:



$name= $data['contact_name'];

$email=$data['contact_email'];

$subject=$data['contact_subject'];

$dogname=$data['contact_dogname'];

$dogbreed=$data['contact_dogbreed'];

$dogage=$data['contact_dogage'];

$telephone= $data['contact_tel'];

$body= $data['contact_message'];



however there is a load of info below it which I haven't edited and i think this is where the content is prepared (the commented out bits are a giveaway i think!):



// Prepare email body

$prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT', JURI::base());

$body= $prefix."\n".$name.' <'.$email.'>'."\r\n\r\n".stripslashes($body);



$mail = JFactory::getMailer();

$mail->addRecipient($contact->email_to);

$mail->addReplyTo(array($email, $name));

$mail->setSender(array($mailfrom, $fromname));

$mail->setSubject($sitename.': '.$subject);

$mail->setBody($body);

$sent = $mail->Send();



//If we are supposed to copy the sender, do so.



// check whether email copy function activated

if ( array_key_exists('contact_email_copy', $data) )

{

$copytext= JText::sprintf('COM_CONTACT_COPYTEXT_OF', $contact->name, $sitename);

$copytext.= "\r\n\r\n".$body;

$copysubject= JText::sprintf('COM_CONTACT_COPYSUBJECT_OF', $subject);



$mail = JFactory::getMailer();

$mail->addRecipient($email);

$mail->addReplyTo(array($email, $name));

$mail->setSender(array($mailfrom, $fromname));

$mail->setSubject($copysubject);

$mail->setBody($copytext);

$sent = $mail->Send();

}



return $sent;

}

}



I did try to edit this last bit but when i sent a test message, It killed the site.

Anyone got any ideas?

Statistics: Posted by jjones1978 — Wed Jan 01, 2014 7:03 pm








via Joomla! http://forum.joomla.org/viewtopic.php?t=800091&p=3123046#p3123046

No comments:

Post a Comment