Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Contact Us - to add extra fields


wancy

Recommended Posts

Hi,

 

At the Contact Us page, currently, it consists of Full Name, email address and comment fields. Now, i would like to add in new extra fields.

 

May i know at which file should i refer and what should i do in the file on the code?

 

Please advice.

Link to comment
Share on other sites

Lets say you want to add the customers phone to the form

 

1) In contact_us.php

find the code

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

replace it with

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
$phone = tep_db_prepare_input($HTTP_POST_VARS['phone']); // add phone 21.6.09
// BOF multimixer//
//define variable $email_body.  if you want to add more fields do so by adding this line [ ."\r\n" . ] between the fields you wish to display and order them accordingly//
$email_body = EMAIL_TEXT_CUSTOMER_NAME . ' ' . $name . "\r\n" . EMAIL_TEXT_CUSTOMER_EMAIL . ' ' .  $email_address . "\r\n" . EMAIL_TEXT_CUSTOMER_PHONE . ' ' . $phone . "\r\n" . EMAIL_TEXT_CUSTOMER_MESSAGE . ' ' . $enquiry;
//define variable $from_email. Set to Store owner email address as defined in Admin panel. If you want mails to be sent from customers mail address, set it to email_address//
$from_email = (STORE_OWNER_EMAIL_ADDRESS);
//EOF multimixer //

//BOF Multimixer//
// $enquiry replaced by $email_body Includes $email_body to message instead of $enquiry. $email_address replaced by $from_email Email is getting send from $from-email instead of $email_address//
if (tep_validate_email($email_address)) {
  tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);
  //EOF multimixer//

 

2) In the same file,

find the code

 <tr>
			<td class="main"><?php echo ENTRY_EMAIL; ?></td>
		  </tr>
		  <tr>
			<td class="main"><?php echo tep_draw_input_field('email'); ?></td>
		  </tr>

add after

  <tr>
			<td class="main"><?php echo ENTRY_PHONE; ?></td>
		  </tr>
		  <tr>
			<td><?php echo tep_draw_input_field('phone'); ?></td>
		  </tr>

 

3) In file includes/languages/yourlanguage/contact_us.php add anywhere befote last ?>

// mm 23.6.2009
define('EMAIL_TEXT_CUSTOMER_NAME', 'Name:');
define('EMAIL_TEXT_CUSTOMER_EMAIL', 'email:');
define('EMAIL_TEXT_CUSTOMER_PHONE', 'Phone:');
define('EMAIL_TEXT_CUSTOMER_MESSAGE', 'Message:');

 

You will have the phone in the form, and the phone send by email. In this configurations mails are send from Store owners mail address

 

Hope it works for you

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...