Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Contact us?? Box


julianpuje

Recommended Posts

When a customer sends an enquiry using the "Contact Us", does anybody know how to change the code, so it uses the customers e:mail field to copy the enquiry to the customer aswell as send it to me???

 

Any help on this appreciated. :thumbsup:

 

Thanks

 

Julian

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Link to comment
Share on other sites

Hi julian,

 

find this piece of code in the contact_us.php

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

 

change it to

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

 

However you might want to change the subject/greeting to include a reference to say that this is their copy.

 

Hope this helps

 

PhilipH

Link to comment
Share on other sites

Thank Philip, that works great. :thumbsup:

Any chance of looking at this code for me and telling me how to do the same thing. It's a modified tell a friend for asking a product question. I've modded it quite a lot, but can't find where to change it to send a copy to the customer.

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

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
   $error = false;

   $to_email_address = tep_db_prepare_input($HTTP_POST_VARS['to_email_address']);
   $to_name = tep_db_prepare_input($HTTP_POST_VARS['to_name']);
   $from_email_address = tep_db_prepare_input($HTTP_POST_VARS['from_email_address']);
   $from_name = tep_db_prepare_input($HTTP_POST_VARS['from_name']);
   $from_telephone = tep_db_prepare_input($HTTP_POST_VARS['from_telephone']);
   $message = tep_db_prepare_input($HTTP_POST_VARS['message']);

   if (empty($from_name)) {
     $error = true;

     $messageStack->add('friend', ERROR_FROM_NAME);
   }

   if (!tep_validate_email($from_email_address)) {
     $error = true;

     $messageStack->add('friend', ERROR_FROM_ADDRESS);
       }

   if (empty($from_telephone)) {
     $error = true;

     $messageStack->add('friend', ERROR_TO_TELEPHONE);
   }

   if (empty($to_name)) {
     $error = true;

     $messageStack->add('friend', ERROR_TO_NAME);
   }

   if (!tep_validate_email($to_email_address)) {
     $error = true;

     $messageStack->add('friend', ERROR_TO_ADDRESS);
   }

   if ($error == false) {
     $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME);
     $email_body = sprintf(TEXT_EMAIL_INTRO, STORE_NAME, $product_info['products_name'], $product_info['products_model']) . "\n\n";

     if (tep_not_null($message)) {
       $email_body .= $message . "\n\n";
       $email_body .= TEXT_EMAIL_SIGNATURE . $from_name . "\n\n";
       $email_body .= TEXT_CONTACT . $from_telephone . "\n\n";
        
     }

     $email_body .= sprintf(TEXT_EMAIL_LINK, tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])) . "\n\n" .
                    sprintf(STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");

     tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address, STORE_NAME);

     $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success');

     tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
   }
 } elseif (tep_session_is_registered('customer_id')) {
   $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
   $account = tep_db_fetch_array($account_query);

   $from_name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
   $from_email_address = $account['customers_email_address'];
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ASK_QUESTION, 'products_id=' . $HTTP_GET_VARS['products_id']));
?>

 

Thanks again :thumbsup:

 

Julian

A little knowledge is dangerous, I SHOULD KNOW.

If Life Begins At 40, What ends????

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...