If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / Can I add extra customer address info to admin copy of order confirmation email?

Can I add extra customer address info to admin copy of order confirmation email?

Started by southshorepizza on 20 Sep 2012, 2:12 AM · Views: 4,294

Results 21 to 32 of 32
22 Apr 2014, 5:19 PM
#21
drbyte avatar

drbyte

Sensei

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

Can I add extra customer address info to admin copy of order confirmation email?

Are these replacements still specifically for the "admin copy" of the email? Or for the customer's copy too?

For the admin email, is there a specific abbreviated version you'd like? Since you're making so many changes to it, maybe a search/replace isn't sufficient anymore, and maybe you should just manually create a completely custom email for the admin. The original ZC code assumes that the admin wants a duplicate copy of what the customer received. But you're doing something completely different than that. Maybe a bespoke message just for order-printing would be a far better approach?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Apr 2014, 6:02 PM
#22
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Can I add extra customer address info to admin copy of order confirmation email?

I see your point. They are still only for the admin.

I am trying to make the receipt look more like a "store" receipt. All our admin emails get printed to a receipt printer. With HTML display I have it looking good but then the receipt printer mangles it and takes forever to print.

With Plain Text the receipt printer does great and is very quick.

Ideally it would look like this:

Credit Card Authorization and Transaction number

Store Name

Delivery Method

Order Number
Order Date

Comments

Products
Totals

Delivery Address

Payment Method

Thanks for shopping.

22 Apr 2014, 6:16 PM
#23
drbyte avatar

drbyte

Sensei

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

Re: Can I add extra customer address info to admin copy of order confirmation email?

What version of Zen Cart?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Apr 2014, 6:39 PM
#24
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Can I add extra customer address info to admin copy of order confirmation email?

zen-cart 1.5.1

22 Apr 2014, 7:24 PM
#25
drbyte avatar

drbyte

Sensei

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

Re: Can I add extra customer address info to admin copy of order confirmation email?

How about something like this (based on original v1.5.1 code, ignoring any changes you've already made):```
// 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'];

  // include authcode and transaction id in admin-copy of email
  if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) {
    $pmt_details = ($GLOBALS[$_SESSION['payment']]->auth_code != '' ? 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  ' : '') . ($GLOBALS[$_SESSION['payment']]->transaction_id != '' ?  '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'];
  }

  /**
   * **********************************************
   * create a special bespoke email for receipt printer
   * **********************************************/
  $email_order = '';
  $email_order .= ($GLOBALS[$_SESSION['payment']]->auth_code != '' ? 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  ' : '') . ($GLOBALS[$_SESSION['payment']]->transaction_id != '' ?  'TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id : '') . "\n\n";
  $email_order .= STORE_NAME . "\n\n";
  $email_order .= HEADING_SHIPPING_METHOD . "\n";
  $email_order .= (zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a') . "\n";
  $email_order .= $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n";
  $email_order .= EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n";
  $email_order .= EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n";
  $email_order .= zen_db_output($this->info['comments']) . "\n\n";
  $email_order .= EMAIL_TEXT_PRODUCTS . "\n";
  $email_order .= EMAIL_SEPARATOR . "\n";
  $email_order .= $this->products_ordered;
  $email_order .= 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 ($this->content_type != 'virtual') {
    $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n";
    $email_order .= EMAIL_SEPARATOR . "\n";
    $email_order .= zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
  }
  $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n";
  $email_order .= EMAIL_SEPARATOR . "\n";
  $email_order .= zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
  if (is_object($GLOBALS[$_SESSION['payment']])) {
    $cc_num_display = (isset($this->info['cc_number']) && $this->info['cc_number'] != '') ? 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";
  }
  $email_order .= EMAIL_THANKS_FOR_SHOPPING . "\n";
  while (strstr($email_order, ' ')) $email_order = str_replace(' ', ' ', $email_order);
  /**
   * **********************************************
   * end of bespoke admin email
   * **********************************************/

  $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_FOR_ADDITIONAL_EMAILS', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg));
  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);
}
$this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL', array($zf_insert_id, $email_order, $extra_info, $html_msg));

}

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Apr 2014, 8:13 PM
#26
southshorepizza avatar

southshorepizza

Zen Follower

Join Date:
Sep 2012
Posts:
253
Plugin Contributions:
0

Re: Can I add extra customer address info to admin copy of order confirmation email?

Thank you. I know this is unusual. I think this is my last question on this. How do I remove the "Office Use Only" from the bottom of this receipt?

Thank you again!

David

22 Apr 2014, 9:21 PM
#27
drbyte avatar

drbyte

Sensei

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

Re: Can I add extra customer address info to admin copy of order confirmation email?

In the black text just below the red text I posted earlier, you'll see a part where this is mentioned:

$email_order . $extra_info['TEXT']

Change that to just this:```
$email_order


It's the . $extra_info['TEXT'] part that's outputting the office-use-only section in the text-only email.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

28 Jan 2015, 2:31 AM
#28
spacemonkey avatar

spacemonkey

Zen Follower

Join Date:
Nov 2013
Location:
Dorset, UK
Posts:
124
Plugin Contributions:
0

Re: Can I add extra customer address info to admin copy of order confirmation email?

Hi,

I have updated this mod from v1.5.1 to v1.5.4 and all appears fine. I have inserted into the orders.php on line 1089, this appears to be the correct place and all runs well. Simple enough!!

My big question...... How can I make the comments line print in bold?

$email_order .= zen_db_output($this->info['comments']) . "\n";

I have tried to use '<strong>comments</strong>' but this just causes a 500 error :no:

Can anyone help please. :frusty:

Cheers

28 Jan 2015, 4:20 AM
#29
drbyte avatar

drbyte

Sensei

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

Re: Can I add extra customer address info to admin copy of order confirmation email?

That line is for a text-only email, so you CAN'T make it appear bold. There's no markup in text-only emails.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

28 Jan 2015, 4:38 AM
#30
spacemonkey avatar

spacemonkey

Zen Follower

Join Date:
Nov 2013
Location:
Dorset, UK
Posts:
124
Plugin Contributions:
0

Re: Can I add extra customer address info to admin copy of order confirmation email?

DrByte:

That line is for a text-only email, so you CAN'T make it appear bold. There's no markup in text-only emails.

Ok thanks,

can you think of any other way of making it stand out? These comments have been missed by staff a few times and I think beating the staff is illegal in the UK! :wacko:

28 Jan 2015, 1:47 PM
#31
drbyte avatar

drbyte

Sensei

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

Re: Can I add extra customer address info to admin copy of order confirmation email?

I suppose you could outline it a bit like this:

  $email_order .= '*****************************************************' . "\n";
  $email_order .= zen_db_output($this->info['comments']) . "\n";
  $email_order .= '*****************************************************' . "\n\n";

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 Feb 2015, 2:36 AM
#32
spacemonkey avatar

spacemonkey

Zen Follower

Join Date:
Nov 2013
Location:
Dorset, UK
Posts:
124
Plugin Contributions:
0

Re: Can I add extra customer address info to admin copy of order confirmation email?

DrByte:

I suppose you could outline it a bit like this:

$email_order .= '' . "\n";
$email_order .= zen_db_output($this->info['comments']) . "\n";
$email_order .= '
' . "\n\n";


Thank you, I have changed the character but does the trick.   :smile: