Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Improvments to Contact Us Page


Guest

Recommended Posts

The modifcation creates a drop down list, or at list with radio buttons..

of email recipients for your contact us page.

 

So someone visiting your store, can choose where the email should go ->

Sales

Billing

Customer Service

etc.

 

Once the modification is installed, you can update the list easily from your OSC admin page

 

Download Here

 

INSTALLATION:
---------------------------------------

BACK UP THESE FILES BEFORE PROCEEDING!
contact_us.php
includes/languages/english/contact_us.php

(it would also be a good idea to make a backup of your database)
---------------------------------------

1.) Run the following mySQL query in phpMyadmin, or use the contact_us.sql file provided.

INSERT INTO configuration SET configuration_title='Set "Contact Us" Email List', date_added=NOW(), sort_order='11', configuration_group_id='1', configuration_key='CONTACT_US_LIST', configuration_value= '', configuration_description='On the "Contact Us" Page, set the list of email addresses , in this format: Name 1 <email@address1>, Name 2 <email@address2>', use_function = NULL , set_function = NULL;  



2.) EDIT THE FOLLOWING FILES:


######  contact_us.php  ######  

FIND:

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


REPLACE WITH:

if (CONTACT_US_LIST !=''){
 $send_to_array=explode("," ,CONTACT_US_LIST);
 preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array);
 $send_to_email= eregi_replace (">", "", $send_email_array[0]);
 $send_to_email= eregi_replace ("<", "", $send_to_email);

 tep_mail(preg_replace('/\<[^*]*/', '', $send_to_array[$send_to]), $send_to_email, EMAIL_SUBJECT, $enquiry, $name, $email_address);
}else{
       tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
}




FIND:

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


REPLACE WITH:

           <?php 
   if (CONTACT_US_LIST !=''){
      echo '<tr><td class="main">'. SEND_TO_TEXT. '</td></tr>'
    	 .'<tr><td class="main">';
    if(SEND_TO_TYPE=='radio'){
    foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {
       if($k==0){
  	 $checked=true;
  	 }else{
  	 $checked=false;
  	 }
  	 echo tep_draw_radio_field('send_to', $k, $checked). " " .preg_replace('/\<[^*]*/', '', $v)."<br>\n";
    }

     }else{
      foreach(explode("," ,CONTACT_US_LIST) as $k => $v) {
     $send_to_array[] = array('id' => $k, 'text' => preg_replace('/\<[^*]*/', '', $v));
     }
         echo tep_draw_pull_down_menu('send_to',  $send_to_array);
     }

	 echo "\n</td></tr>\n";
	 
	 }
   ?>

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



######  includes/languages/english/contact_us.php  ######  

FIND:

?>


INSERT BEFORE:

define('SEND_TO_TEXT', 'Send Contact Form To:');
define('SEND_TO_TYPE', 'radio');  //this will create a radio buttons for your contact list
//define('SEND_TO_TYPE', ''); Change to this for a dropdown menu.

//END

Link to comment
Share on other sites

there seems to be a problem is you select the first recipient using radio buttons. selecting any other contact works fine except selecting the first one in the list...

 

ideas?

Link to comment
Share on other sites

Hi there,

 

I fixed the bug..

You can download the latest file here

 

Or... for a quick fix,

Open your shop/contact_us.php

REPLACE: 
'send_to', $k

WITH
'send_to', "$k"

Sweet! Good Job!

 

I really like this simple but cosmetically better design...

 

Thanks for everything!

 

B)

Link to comment
Share on other sites

I installed the contribution, but now how do i configure the emails from the admin page. I am sorry but i couldn't find any instructions on it

it was created when you executed the .sql file. look under "my store" in the admin console for the additional area for input

Link to comment
Share on other sites

  • 1 month later...

Thanks for the contribution.

 

Ive added a few fields to my form (dont know if Ive done it the right way but anyhow it works). However I cant find a way of sending the title of the email ie sales so it is recieved in the body of the email as per my other form data .

 

can you please help.

 

My modification as below:

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {

if (tep_validate_email(trim($HTTP_POST_VARS['email']))) {

if (CONTACT_US_LIST !=''){

$send_to_array=explode("," ,CONTACT_US_LIST);

preg_match('/\<[^>]+\>/', $send_to_array[$send_to], $send_email_array);

$send_to_email= eregi_replace (">", "", $send_email_array[0]);

$send_to_email= eregi_replace ("<", "", $send_to_email);

$email_address = ' Email: ' . tep_db_prepare_input($HTTP_POST_VARS['email']);

$enquiry = '' . tep_db_prepare_input($HTTP_POST_VARS['firstname']);

$enquiry .= ':' . tep_db_prepare_input($HTTP_POST_VARS['lastname']) . "\n";

$enquiry .= ' Company: ' . tep_db_prepare_input($HTTP_POST_VARS['company']) . "\n";

$enquiry .= ' PostCode: ' . tep_db_prepare_input($HTTP_POST_VARS['postcode']) . "\n";

$enquiry .= ' Invoice/Order Number: ' . tep_db_prepare_input($HTTP_POST_VARS['invoice']) . "\n";

$enquiry .= ' Enquiry: ' . tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

Link to comment
Share on other sites

  • 3 months later...

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...