Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how to add more fields in contact us page?


giroro_

Recommended Posts

It's pretty easy to add more fields to the contact us page. But since those fields are not related to any database fields, you got to add the values to the mail content if you need to see the values, which I estimate. As an example on how to do this, I put the code of a modified contact us page in here. But note, that you can't use it as it is, because it has some fields depending on installed add-ons.

 

What goes to the boxed version, you got to create a box in the same way as the others are, basically using the content of contact_us.php but you need to change the html part in order to fit in there.

 

<?php
/*
 $Id: contact_us.php,v 1.42 2003/06/12 12:17:07 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
   $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
   $address = tep_db_prepare_input($HTTP_POST_VARS['address']);
   $phone = tep_db_prepare_input($HTTP_POST_VARS['phone']);
   $phone_verify = tep_db_prepare_input($HTTP_POST_VARS['phone_verify']);
   $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
   $email_address_verify = tep_db_prepare_input($HTTP_POST_VARS['email_verify']);
   $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
//rmh referral start
   $source = tep_db_prepare_input($HTTP_POST_VARS['source']);
   if (isset($HTTP_POST_VARS['source_other'])) $source_other = tep_db_prepare_input($HTTP_POST_VARS['source_other']);
//rmh referral end

   if (strlen($name) == 0) {
     $error = true;

     $messageStack->add('contact', 'Please enter your name!');
   }

   if (strlen($phone) < ENTRY_TELEPHONE_MIN_LENGTH) {
     $error = true;

     $messageStack->add('contact', ENTRY_TELEPHONE_NUMBER_ERROR);
   } else {
     if($phone != $phone_verify){
     $error = true;

     $messageStack->add('contact', ENTRY_TELEPHONE_NUMBER_VERIFY_ERROR);
     }  
   }

   if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
     $error = true;

     $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_ERROR);
   } elseif ($email_address != '' && tep_validate_email($email_address) == false) {
     $error = true;

     $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
   } else {
     if($email_address != $email_address_verify){
     $error = true;

     $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_VERIFY_ERROR);
     }  
   }

//rmh referral start
   if ((REFERRAL_REQUIRED == 'true') && (is_numeric($source) == false)) {
       $error = true;

       $messageStack->add('contact', ENTRY_SOURCE_ERROR);
   }

   if ((REFERRAL_REQUIRED == 'true') && (DISPLAY_REFERRAL_OTHER == 'true') && ($source == '9999') && (!tep_not_null($source_other)) ) {
       $error = true;

       $messageStack->add('contact', ENTRY_SOURCE_OTHER_ERROR);
   }
//rmh referral end

   if ($error == false) {

//Start to concatenate the submitted informations
     $email_content = "Name               :". $name ."\n\n";
     $email_content .= EMAIL_SEPARATOR . "\n";
     $email_content .= "Address           :". $address ."\n\n";
     $email_content .= EMAIL_SEPARATOR . "\n";
     $email_content .= "Daytime Telephone :". $phone."\n\n";
     $email_content .= EMAIL_SEPARATOR . "\n";
     $email_content .= "E-Mail Address    :". $email_address."\n\n";
     $email_content .= EMAIL_SEPARATOR . "\n";
     $email_content .= "Heard about us by :". $source."\n\n";
     $email_content .= EMAIL_SEPARATOR . "\n";
     $email_content .= EMAIL_SEPARATOR . "\n";
     $email_content .= "Enquiry: \n". $enquiry;


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

     tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
   }
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<style type="text/css">
<!--
.style1 {font-size: 12px}
-->
</style>
</head>
<body >
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0"  style="height:100%;">
 <tr>
 	<td class="col_left">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</td>
<!-- body_text //-->
   <td width="100%" class="col_center"><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?>
     <table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr><td>

       <p>
         <?php tep_draw_heading_top();?>

         <?php new contentBoxHeading_ProdNew($info_box_contents);?>

         <?php tep_draw_heading_top_1();?>
       </p>
       <p><span class="prod_info style1"><strong>Event Bars</strong></span><br>
         Office 1A Deerpark Business Centre,<br>
         Oranmore<br>
         Co. Galway<br>
         <span class="style1"><strong><br>
         +353 (0)91 778876<br>
         +353 (0)87 7777585</strong></span><br>
         <br>
         <strong>Event Bars</strong> is a registered business name of <strong>Home Kegs ltd</strong>.<br>
         <br>
         Registered business no: <strong>322272</strong><br>
         Vat no:<strong> 6413783Q</strong><br>
         <br>
         Home kegs ltd is a registered limited company in the Republic of Ireland. Company registration number<strong> 393783</strong>.</p>
       <table cellpadding="0" cellspacing="0" border="0" width="100%">
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	      </tr>
         <?php
	  if ($messageStack->size('contact') > 0) {
	?>
         <tr>
           <td><?php echo $messageStack->output('contact'); ?></td>
	      </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	      </tr>
         <?php
	  }

	  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
	?>
         <tr>
           <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_SUCCESS; ?></td>
	      </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	      </tr>
         <tr>
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2" class="infoBox">
             <tr class="infoBoxContents">
               <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					  <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
					  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				    </tr>
                 </table></td>
			    </tr>
             </table></td>
	      </tr>
         </table>
	  <?php
	  } else {
	?>
       <table cellpadding="0" cellspacing="0" border="0" width="100%"> 
         <tr><td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>
         </tr>
         <tr>
           <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
             <tr class="infoBoxContents">
               <td><table border="0" width="100%" cellspacing="5" cellpadding="2">
             <tr>
               <td class="main"><?php echo ENTRY_NAME; ?></td>
               <td class="main"><?php echo tep_draw_input_field('name'); ?><span class="inputRequirement">*</span></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_ADDRESS; ?></td>
              <td class="main"><?php echo tep_draw_textarea_field('address', 'soft', 50, 4); ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
              <td class="main"><?php echo tep_draw_input_field('phone'); ?><span class="inputRequirement">*</span></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER_VERIFY; ?></td>
              <td class="main"><?php echo tep_draw_input_field('phone_verify'); ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_EMAIL; ?></td>
              <td class="main"><?php echo tep_draw_input_field('email'); ?></td>
             </tr>
             <tr>
               <td class="main"><?php echo ENTRY_EMAIL_ADDRESS_VERIFY; ?></td>
              <td class="main"><?php echo tep_draw_input_field('email_verify'); ?></td>
             </tr>
<!-- //rmh referral start -->
<?php
 if ((tep_not_null(tep_get_sources()) || DISPLAY_REFERRAL_OTHER == 'true') && (!tep_session_is_registered('referral_id') || (tep_session_is_registered('referral_id') && DISPLAY_REFERRAL_SOURCE == 'true')) ) {
?>
     <tr>
       <td colspan="2"><table border="0" width="100%" cellspacing="1" cellpadding="2" >
         <tr >
           <td><table border="0" cellspacing="2" cellpadding="2">
             <tr>
               <td class="main"><?php echo ENTRY_SOURCE; ?></td>
               <td class="main"><?php echo tep_get_source_list('source', (DISPLAY_REFERRAL_OTHER == 'true' || (tep_session_is_registered('referral_id') && tep_not_null($referral_id)) ? true : false), (tep_session_is_registered('referral_id') && tep_not_null($referral_id)) ? '9999' : '') . ' ' . (tep_not_null(ENTRY_SOURCE_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_TEXT . '</span>': ''); ?></td>
             </tr>
<?php
   if (DISPLAY_REFERRAL_OTHER == 'true' || (tep_session_is_registered('referral_id') && tep_not_null($referral_id))) {
?>
             <tr>
               <td class="main"><?php echo ENTRY_SOURCE_OTHER; ?></td>
               <td class="main"><?php echo tep_draw_input_field('source_other', (tep_not_null($referral_id) ? $referral_id : '')) . ' ' . (tep_not_null(ENTRY_SOURCE_OTHER_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_OTHER_TEXT . '</span>': ''); ?></td>
             </tr>
<?php
   }
?>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 } else if (DISPLAY_REFERRAL_SOURCE == 'false') {
     echo tep_draw_hidden_field('source', ((tep_session_is_registered('referral_id') && tep_not_null($referral_id)) ? '9999' : '')) . tep_draw_hidden_field('source_other', (tep_not_null($referral_id) ? $referral_id : ''));
 }
?>
<!-- //rmh referral end -->
                 <tr>
                   <td class="main"><?php echo ENTRY_ENQUIRY; ?></td>
                   <td><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15); ?></td>
				    </tr>
                 </table>
				  <table cellpadding="0" cellspacing="0" border="0" width="100%">
				    <tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
				    </table>
				  <table border="0" width="100%" cellspacing="0" cellpadding="2">
				    <tr>
				      <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
						  <td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
						  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				      </tr>
				    </table>
				  <table cellpadding="0" cellspacing="0" border="0" width="100%">
				    <tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
				    </table>
				  </td>
			    </tr>
             </table></td>
	      </tr>
         </table>


 <?php
 }
?>


 <?php tep_draw_heading_bottom_1();?>					

 <?php tep_draw_heading_bottom();?>

       </td></tr>
     </table>
  </form></td><!-- body_text_eof //-->
   <td class="col_right">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //--></body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...