Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Admin Email for Order Information


Guest

Recommended Posts

I need to have the admin recieve an email that contains all the information that the customer recieves on his email but with a few more details and fields like cost price and supplier information that the customer sould NOT see. How would I get a duplicate email sent to admin for each order but with different information.

 

I know the code that contains the info that is sent in the email is in checkout_process.php but I don't know how I'd duplicate that and send one to the customer (default one) and my increased info one to admin.

 

Any help here would be much appreciated.

 

No doubt there will be a simple solution thats staring me in the face that I've overlooked :-"

 

Thanks

Link to comment
Share on other sites

This code shows how to add a few lines at the bottom of the email being sent to the store owner.

 

You can retrieve and just append the information like this at the end of the mail.

If you want it integrated with the order lines, you'll need to duplicate the $email_order variable and the processing around it..

 

  tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
//BoF Belgian law
 $email_order .= EMAIL_VERZAKING . "\n\n";
//EoF Belgian Law

   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Thanks for the reply Bruyndoncx,

 

Soyou mean something like this :-

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT . ' #' . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
####add variable here####
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT . ' #' . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

 

like this :-

 

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT . ' #' . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
// added admin email code start
if (!tep_session_is_registered('noaccount')) 
{
 $email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) 
 {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";
} else {
 $email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";
 }

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
   $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                   EMAIL_SEPARATOR . "\n" .
                  // tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
      $order->delivery['firstname'] . ' ' . $order->delivery['lastname'] . "\n" . 
                  $order->delivery['company'] . "\n" .
                  $order->delivery['street_address'] . "\n" .
                  $order->delivery['suburb'] . "\n" . 
                  $order->delivery['city'] . "\n" .
                  $order->delivery['postcode'] . "\n" . 
                  $order->delivery['state'] . "\n" . 
                  $order->delivery['country']['title'] . "\n\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 // tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
     "ID: " . $customer_id . "\n" .
                 $order->customer['firstname'] . ' ' . $order->customer['lastname'] . "\n" .
                 $order->customer['company'] . "\n" .
                 $order->customer['street_address'] . "\n" .
                 $order->customer['suburb'] . "\n" .
                 $order->customer['city'] . "\n" .
                 $order->customer['postcode'] . "\n" . 
                 $order->customer['state'] . "\n" .
                 $order->customer['country']['title'] . "\n" . 
                 "Telephone: " . $order->customer['telephone'] . "\n" . 
                 "Email: " . $order->customer['email_address'] . "\n\n";
 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $payment_class->title . "\n\n";
   if ($payment_class->email_footer) { 
     $email_order .= $payment_class->email_footer . "\n\n";
// purchaseorders_1_4 start
     if($order->info['purchase_order_number'])
	 {
       $email_order .= EMAIL_TEXT_PURCHASE_ORDER_NUMBER . $order->info['purchase_order_number'] . "\n";
     }
// purchaseorders_1_4 end
   }
 }
// added admin email code end
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT . ' #' . $insert_id, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

 

Or do I need more than that?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...