Joomla 3.1
Com_contact
Contact add new field example is Phone Number view
1. Add new field Phone to form
components\com_contact\views\contact\tmpl\default_form.php
<div class="control-group">
<div class="control-label"><?php echo JText::_('COM_CONTACT_EMAIL_LABEL'); ?></div>
<div class="controls"><?php echo $this->form->getInput('contact_email'); ?></div>
<div class="clr"></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo JText::_('COM_CONTACT_PHONE_LABEL'); ?></div>
<div class="controls"><input type="text" size="60" value="" id="jform_contact_phone" name="jform[contact_phone]" ></div>
<div class="clr"></div>
</div>
<div class="control-group">
<div class="control-label"><?php echo JText::_('COM_CONTACT_CONTACT_MESSAGE_SUBJECT_LABEL'); ?></div>
<div class="controls"><?php echo $this->form->getInput('contact_subject'); ?></div>
<div class="clr"></div>
</div>
2. Send mail : add new content to mail body
files: components\com_contact\controllers\contact.php at function private function _sendEmail
Replace: line 156-161:
$phone = 'Phone Number: '.$data['contact_phone'];
$body = $data['contact_message'];
// Prepare email body
$prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT', JUri::base());
$body = $prefix."\n".$name.' <'.$email.'>'."\r\n\r\n".$phone."\n".stripslashes($body);
Result is:
Thứ Sáu, 4 tháng 10, 2013
Đăng ký:
Đăng Nhận xét (Atom)
0 nhận xét:
Đăng nhận xét