Zen Cart Logo
Forums / General Questions / how can i make different emails for admin and customers?

how can i make different emails for admin and customers?

Locked

Views: 4,915

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
29 Sep 2009, 8:48 AM
#1
shisha avatar

shisha

New Zenner

Join Date:
Sep 2009
Posts:
12
Plugin Contributions:
0

how can i make different emails for admin and customers?

The emails send to admin and customers are the same.

this is because the admin only gets a copy from the email send to customer.

even when i use html-mails for customers and text for the admin,
i have still the same content.

What can i do to make a different email for the admin?

I need only the plain order in the admin email.

The Plain order with Date , Adress, Email from customer, items ordered, price, comments.

Not more, not less. How can i do this?

29 Sep 2009, 1:25 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: how can i make different emails for admin and customers?

In the Configuration ... Email Options ... what do you have set for:

Email Admin Format?
Please select the Admin extra email format

TEXT
HTML

29 Sep 2009, 6:06 PM
#3
shisha avatar

shisha

New Zenner

Join Date:
Sep 2009
Posts:
12
Plugin Contributions:
0

Re: how can i make different emails for admin and customers?

thanks for you assistance.

I have already different email formats.

text for admin ,
html for customers.

BUT: Its still the same inside. Only the formatting is different.

29 Sep 2009, 6:46 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: how can i make different emails for admin and customers?

You would have to do a lot of customization to the order.php class file to build totally separate emails ...

Currently, they are built together with just subtle differences to add additional information and change email addresses ...

6 Oct 2009, 5:12 PM
#5
shisha avatar

shisha

New Zenner

Join Date:
Sep 2009
Posts:
12
Plugin Contributions:
0

Re: how can i make different emails for admin and customers?

It is vital for me to have a plain email that contains only the order.

First i have to delete, or comment, the "send copy to admin" funktion.
Where is it ?

Then, I think it will be best to copy the email part in order.php and
send it to admin email address.
This is to tricky for me, because i am not a experienced php coder.

After that i can customize this part of order.php in a way that the from adress is the Customers email-Adress, and delete all other parts.

can somebody help me with this ?

6 Oct 2009, 5:30 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: how can i make different emails for admin and customers?

What exactly do you want? And why exactly do you want that? Is there a particular business problem you're trying to solve?

6 Oct 2009, 7:43 PM
#7
shisha avatar

shisha

New Zenner

Join Date:
Sep 2009
Posts:
12
Plugin Contributions:
0

Re: how can i make different emails for admin and customers?

DrByte:

What exactly do you want? And why exactly do you want that? Is there a particular business problem you're trying to solve?

Dr. Byte ,

sorry when i am not clear enough, i am German, maybe my English is not good enough.

I need the plain order for me ( Admin) because i process all orders with my own ERP System. Therefore i need this admin email that looks like an order. In an order for me, i dont need the phrase "Helo mr. boddu, thanks for you order" and so on.

I only need the plain order. Send from the email adress of the Customer, because the Customer orders things, not the Shop, and i reply with my System to the Customer.

The email should content of:

Name , Date, Address, Items. Price , Remarks . That is all.

Now it looks like this: (I translate important things for understanding)

Auftragsbestätigung von Shisha.de

Hello Bernd Brause

Vielen Dank für Ihren Einkauf!
Im Nachfolgenden sehen Sie die Details Ihrer Bestellung.

Remarks:
HuHu

Bestellnummer: 43
Bestelldatum: Dienstag, 06. Oktober 2009
Artikel

1 x (w211b) Thing = €45.00

Zwischensumme inkl.MwSt.: €45.00
Versandkostenpauschale (Standard): €5.00
Endsumme inkl. MwSt.: €50.00
19%: €7.18

ShippingAdresss

Bernd Brause
Street
City
Country

BillingAdresss

Bernd Brause
Street
City
Country

Payment

Vorkasse/Überweisung

Bitte überweisen Sie den Betrag auf das Konto: Empfaenger: ------Accoung info -----

Ihre Bestellung wird versendet, sobald wir den Betrag erhalten haben.

Verwendungszweck: Best.sh.43

Hier finden Sie den Link zu unseren AGB's und zu Ihrem Rueckgaberecht:
http://www.domain.de.de/index.php?main_page=conditions

My Adress

http://www.mydomain.de
[email protected]
USt.ID: DE198478

Sollten Sie diese Nachricht durch eine Fehler erhalten haben, wenden Sie
sich bitte an: [email protected]


Copyright (c) 2009 Zen-Cart. Powered by ZenCart

Nur für den internen Gebrauch:
Absender:
E-Mail:
Kontoname: Bernd Brause
E-Mail Adresse: [email protected]
Telefon: 037 705
IP Adresse: 79..106.152 - 79..106.152
Hostname: p4FD76A98.dialin.net
Datum und Uhrzeit: Tue Oct 6 2009 10:21:56 CEST

I need this:

Bestellnummer: 43 Bestelldatum: 06. Oktober 2009

Shippingadress

Bernd Brause
Street
City
Country

BillingAdresss

Bernd Brause
Street
City
Country

Payment: Vorkasse/Überweisung (PREPAYMENT)


1 x (w211b) Thing = €45.00

Zwischensumme inkl.MwSt.: €45.00
Versandkostenpauschale (Standard): €5.00
Endsumme inkl. MwSt.: €50.00
19%: €7.18

Remarks:

HuHu


Copyright (c) 2009 Zen-Cart. Powered by ZenCart

Nur für den internen Gebrauch: (Only for internal use)
Absender:
E-Mail:
Kontoname: Bernd Brause
E-Mail Adresse: [email protected]
Telefon: 037 705
IP Adresse: 79..106.152 - 79..106.152
Hostname: p4FD76A98.dialin.net
Datum und Uhrzeit: Tue Oct 6 2009 10:21:56 CEST

thats all.

7 Oct 2009, 4:30 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: how can i make different emails for admin and customers?

The order-confirmation emails are built in the send_order_emails method of the order class.
You can rewrite that code to suit your unique custom needs.

7 Oct 2009, 7:57 AM
#9
shisha avatar

shisha

New Zenner

Join Date:
Sep 2009
Posts:
12
Plugin Contributions:
0

Re: how can i make different emails for admin and customers?

i found : send_order_email in

/ipn_main_handler.php

Line #252 : $order->send_order_email($insert_id, 2);
/includes/classes/order.php

Line #893 : function send_order_email($zf_insert_id, $zf_mode) {

Line #1025 : $zco_notifier->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL');
/includes/modules/checkout_process.php

Line #76 : $order->send_order_email($insert_id, 2);

Line #77 : $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL'); 

do i have to modify all 3 places? or just /classes/order.php

7 Oct 2009, 11:59 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: how can i make different emails for admin and customers?

Most of those are places where it's used.
The place where the function is defined is the one in order.php ... where it starts with "function".

7 Oct 2009, 12:40 PM
#11
shisha avatar

shisha

New Zenner

Join Date:
Sep 2009
Posts:
12
Plugin Contributions:
0

Re: how can i make different emails for admin and customers?

ok, then how to change this lines to make a second email to admin?

/includes/classes/order.php           Line #893 : 
function send_order_email($zf_insert_id, $zf_mode) {
    global $currencies, $order_totals, $zco_notifier;

    //      print_r($this);
    //      die();
    if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL=='1') {
      // send an email
      $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
      zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)),'low_stock');
    }

    // lets start with the email confirmation
    // make an array to store the html version
    $html_msg=array();

    //intro area
    $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" .
    $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" .
    EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
    EMAIL_SEPARATOR . "\n" .
    EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" .
    EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" ;
 // EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
    $html_msg['EMAIL_TEXT_HEADER']     = EMAIL_TEXT_HEADER;
    $html_msg['EMAIL_TEXT_FROM']       = EMAIL_TEXT_FROM;
    $html_msg['INTRO_STORE_NAME']      = STORE_NAME;
    $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
    $html_msg['EMAIL_DETAILS_FOLLOW']  = EMAIL_DETAILS_FOLLOW;
    $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
    $html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id;
    $html_msg['INTRO_DATE_TITLE']      = EMAIL_TEXT_DATE_ORDERED;
    $html_msg['INTRO_DATE_ORDERED']    = strftime(DATE_FORMAT_LONG);
  //$html_msg['INTRO_URL_TEXT']        = EMAIL_TEXT_INVOICE_URL_CLICK;
  //$html_msg['INTRO_URL_VALUE']       = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);

    //comments area
    if ($this->info['comments']) {
      $email_order .= zen_db_output($this->info['comments']) . "\n\n";
      $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));
    } else {
      $html_msg['ORDER_COMMENTS'] = '';
    }

    //products area
    $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
    EMAIL_SEPARATOR . "\n" .
    $this->products_ordered .
    EMAIL_SEPARATOR . "\n";
    $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
    $html_msg['PRODUCTS_DETAIL']='<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';

    //order totals area
    $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . ' ' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' .'</td> </tr>' . "\n" . '<tr>';
    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";
      $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' .($order_totals[$i]['text']) .'</td> </tr>' . "\n" . '<tr>';
    }
    $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';

    //addresses area: Delivery
    $html_msg['HEADING_ADDRESS_INFORMATION']= HEADING_ADDRESS_INFORMATION;
    $html_msg['ADDRESS_DELIVERY_TITLE']     = EMAIL_TEXT_DELIVERY_ADDRESS;
    $html_msg['ADDRESS_DELIVERY_DETAIL']    = ($this->content_type != 'virtual') ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
    $html_msg['SHIPPING_METHOD_TITLE']      = HEADING_SHIPPING_METHOD;
    $html_msg['SHIPPING_METHOD_DETAIL']     = (zen_not_null($this->info['shipping_method'])) ? $this->info['shipping_method'] : 'n/a';

    if ($this->content_type != 'virtual') {
      $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
      EMAIL_SEPARATOR . "\n" .
      zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
    }

    //addresses area: Billing
    $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
    EMAIL_SEPARATOR . "\n" .
    zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
    $html_msg['ADDRESS_BILLING_TITLE']   = EMAIL_TEXT_BILLING_ADDRESS;
    $html_msg['ADDRESS_BILLING_DETAIL']  = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");

    if (is_object($GLOBALS[$_SESSION['payment']])) {
      $cc_num_display = (isset($this->info['cc_number']) && $this->info['cc_number'] != '') ? substr($this->info['cc_number'], 0, 4) . str_repeat('X', (strlen($this->info['cc_number']) - 8)) . substr($this->info['cc_number'], -4) . "\n\n" : '';
      $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
      EMAIL_SEPARATOR . "\n";
      $payment_class = $_SESSION['payment'];
      $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
      $email_order .= (isset($this->info['cc_type']) && $this->info['cc_type'] != '') ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '';
      $email_order .= ($GLOBALS[$payment_class]->email_footer) ? $GLOBALS[$payment_class]->email_footer . "\n\n" : '';
    } else {
      $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
      EMAIL_SEPARATOR . "\n";
      $email_order .= PAYMENT_METHOD_GV . "\n\n";
    }
    $html_msg['PAYMENT_METHOD_TITLE']  = EMAIL_TEXT_PAYMENT_METHOD;
    $html_msg['PAYMENT_METHOD_DETAIL'] = (is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV );
    $html_msg['PAYMENT_METHOD_FOOTER'] = (is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '') ? nl2br($GLOBALS[$payment_class]->email_footer) : (isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '');

// Verwendungszweck (use for)
    $email_order .= "Verwendungszweck: Best.sh." . $zf_insert_id;
    // Rückgaberecht
    $email_order .= "\n\nHier finden Sie den Link zu unseren AGB's und zu Ihrem Rueckgaberecht: " . " http://www.shisha.de/index.php?main_page=conditions";
    
        // include kompletter Adresse
    $email_order .= "\n\nShisha.de - Michael Duhnke\nObere Neustadt 3\nD-08451 Crimmitschau\nFon: 03762 705350\nhttp://www.shisha.de\[email protected]\nUSt.ID: DE198424278";
     
    // include disclaimer
    $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
    // include copyright
    $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";

    while (strstr($email_order, ' ')) $email_order = str_replace(' ', ' ', $email_order);

    $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
    $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
    //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
    $html_msg['EXTRA_INFO'] = '';
    $zco_notifier->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg));
    zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);

    // send additional emails
    if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
      $extra_info=email_collect_extra_info('','', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
      $html_msg['EXTRA_INFO'] = $extra_info['HTML'];

      if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) {
        $pmt_details = 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id . "\n\n";
        $email_order = $pmt_details . $email_order;
        $html_msg['EMAIL_TEXT_HEADER'] = nl2br($pmt_details) . $html_msg['EMAIL_TEXT_HEADER'];
      }

      zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
      $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
    }
    $zco_notifier->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL');
  }

}
9 Oct 2009, 5:44 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: how can i make different emails for admin and customers?

shisha:

ok, then how to change this lines to make a second email to admin?
Essentially, you'll just duplicate the whole thing but change who receives it and edit out some of the sections you don't want to show up:
The first 80% of the code is building the content.
Then it sends the email to the customer.
Then it adds the office-use-only "extra" part, and sends it to the administrator.
You'll need to duplicate the content-building part inside the section where it adds the extra office-use part, leaving out the parts you don't want included on the admin's copy of the message.

24 Jun 2010, 7:22 AM
#13
bhadz08 avatar

bhadz08

New Zenner

Join Date:
Jun 2009
Posts:
41
Plugin Contributions:
0

Re: how can i make different emails for admin and customers?

does anybody here got a solution for this?

please share some...

help here is much appreciated..