Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add Text Input Fields to contact_us


Guest

Recommended Posts

Ok, I searched all day to find a reasonable solution to simply adding additional text fields to the contact_us.php page. I seen many people asking same question all left without an answer. I created a solution that works, however if anyone has any suggestions towards it please feel free to add them.

 

You'll need to edit only 2 pages to add fields to your contact_us.php form.

 

1. /catalog/includes/languages/<your language>/contact_us.php

 

Add to this page: (replacing ENTRY_PHONE with your new field, and 'Phone Number' with your fields desription)

define('ENTRY_PHONE', 'Phone Number: ');

 

2. /catalog/contact_us.php

 

Near line 80 look for:

<tr>

       <td><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="2">

         <tr>

           <td class="main"><?php echo ENTRY_NAME; ?><br><?php echo tep_draw_input_field('name', ($error ? $HTTP_POST_VARS['name'] : $first_name)); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_EMAIL; ?><br><?php echo tep_draw_input_field('email', ($error ? $HTTP_POST_VARS['email'] : $email_address)); if ($error) echo ENTRY_EMAIL_ADDRESS_CHECK_ERROR; ?></td>

         </tr>

   <tr>

           <td class="main"><?php echo ENTRY_PHONE; ?></td>

         </tr>

         <tr>

           <td><?php echo tep_draw_input_field('phone'); ?></td>

         </tr>

         <tr>

   <tr>

           <td class="main"><?php echo ENTRY_ENQUIRY; ?></td>

         </tr>

         <tr>

           <td><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15, $HTTP_POST_VARS['enquiry']); ?></td>

         </tr>

         <tr>

           <td class="main" align="right"><br><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

         </tr>

       </table></form></td>

     </tr>

 

As you can see, here we just insert another table row specifying our new input field.

 

3. Near line 20 look for:

tep_mail(STORE_OWNER,  STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, (ENTRY_ENQUIRY . $HTTP_POST_VARS['enquiry'] . "<br />n" . "<br />n" . ENTRY_PHONE . $HTTP_POST_VARS['phone']), $HTTP_POST_VARS['name'], $HTTP_POST_VARS['email']);

 

The most important part here is created within the ( and ) brackets. Enquiry was already set to print in the message portion of the email, so all I really did was extend what it prints to include any other form data gathered from the contact_us page. Using new line and break tags, and the definitions from /languages/contact_us.php I simply included the names, then a break tag, then the data sent from the user.

 

This should be able to be expanded to add drop downs and any other forms of user input fields into the message body of the email.

 

If anyone has any questions, or has any reasons this method should not be used or could be improved upon, please let me know.

 

C

Link to comment
Share on other sites

  • 5 weeks later...

So does this pass the data onto the e-mail sent to the store owner? I just want to make sure before I give it a shot. This looks like exactly what I need :)

 

Thanks!!

-Richard

---------------------------------------------------

Where would I be without the Forums?!?!

Link to comment
Share on other sites

  • 9 months later...

HI there,

 

First of all thanks for this easy solution

Please could you assist me with adding optons to this form and having having them display in the e-mail.. i have managed to get the option on the web page but they do not come up in the e-mail.

 

And also for the country options i have put that but in my e-mail i am getting the country ID number instead of a the country name..

 

any help would be great,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...