Zen Cart Logo
Forums / Managing Customers and Orders / Add to office use only in confirm email to admin

Add to office use only in confirm email to admin

Views: 1,941

Results 1 to 8 of 8
12 Dec 2013, 10:39 PM
#1
jimmyv avatar

jimmyv

Zen Follower

Join Date:
Feb 2008
Location:
Philadelphia
Posts:
292
Plugin Contributions:
2

Add to office use only in confirm email to admin

I have been monkeying with this area and it's just not posting into the email so I am clearly doing something wrong.

To update/increase the office use only section of the email I altered 2 files

  1. email_extras to add a define
  2. functions_email to add the line into the email

But nothing shows in the confirm email. I do not want the line going to clients that order.

Here is the code in (I think) the relevant section

function email_collect_extra_info($from, $email_from, $login, $login_email, $login_phone='', $login_fax='', $login_customers_extrafield5='') {
// get host_address from either session or one time for both email types to save server load
if (!$_SESSION['customers_host_address']) {
if (SESSION_IP_TO_HOST_ADDRESS == 'true') {
$email_host_address = @gethostbyaddr($_SERVER['REMOTE_ADDR']);
} else {
$email_host_address = OFFICE_IP_TO_HOST_ADDRESS;
}
} else {
$email_host_address = $_SESSION['customers_host_address'];
}

// generate footer details for "also-send-to" emails
$extra_info=array();
$extra_info['TEXT'] =
  OFFICE_USE . "\t" . "\n" .
  OFFICE_FROM . "\t" . $from . "\n" .
  OFFICE_EMAIL. "\t" . $email_from . "\n" .
  (trim($login) !='' ? OFFICE_LOGIN_NAME . "\t" . $login . "\n"  : '') .
  (trim($login_email) !='' ? OFFICE_LOGIN_EMAIL . "\t" . $login_email . "\n"  : '') .
  ($login_phone !='' ? OFFICE_LOGIN_PHONE . "\t" . $login_phone . "\n" : '') .
  ($login_fax !='' ? OFFICE_LOGIN_FAX . "\t" . $login_fax . "\n" : '') .
  ($login_customers_extrafield5 !='' ? OFFICE_FIELD5 . "\t" . $login_customers_extrafield5 . "\n" : '') .
  OFFICE_IP_ADDRESS . "\t" . $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR'] . "\n" .
  OFFICE_HOST_ADDRESS . "\t" . $email_host_address . "\n" .
  OFFICE_DATE_TIME . "\t" . date("D M j Y G:i:s T") . "\n\n";

Needless to say the thing I am attempting to add is one of the extrafields from the related plugin whose data lies in customer so in same table as some of the other pulls.

Is there another thing I am missing? Probably

13 Dec 2013, 1:37 AM
#2
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Add to office use only in confirm email to admin

Be sure to add your new field to this file:
includes/classes/order.php
As it will compile the data for the checkout to send the email.

13 Dec 2013, 3:28 PM
#3
jimmyv avatar

jimmyv

Zen Follower

Join Date:
Feb 2008
Location:
Philadelphia
Posts:
292
Plugin Contributions:
2

Re: Add to office use only in confirm email to admin

Unfortunately still not solved. I added this stuff lines 43 ish orders.php

$order_query = "select customers_id, customers_name, customers_company,
customers_street_address, customers_suburb, customers_city,
customers_postcode, customers_state, customers_country,
customers_telephone, customers_email_address, customers_extrafield5, customers_address_format_id,
delivery_name, delivery_company, delivery_street_address, delivery_suburb,
delivery_city, delivery_postcode, delivery_state, delivery_country,
delivery_address_format_id, billing_name, billing_company,
billing_street_address, billing_suburb, billing_city, billing_postcode,
billing_state, billing_country, billing_address_format_id,
payment_method, payment_module_code, shipping_method, shipping_module_code,
coupon_code, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value,
date_purchased, orders_status, last_modified, order_total, order_tax, ip_address
from " . TABLE_ORDERS . "
where orders_id = '" . (int)$order_id . "'";

then at bottom in additional details I added this

// 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'], $this->customer['customers_extrafield5']);
$html_msg['EXTRA_INFO'] = $extra_info['HTML'];

this is added to the original code. Nothing posts to the office use yet...

14 Dec 2013, 4:16 AM
#4
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Add to office use only in confirm email to admin

includes/classes/order.php
Add your new field to all of the sql customer data fields:

'customers_extrafield5' => $this->customer['extrafield5'],

14 Dec 2013, 7:37 PM
#5
jimmyv avatar

jimmyv

Zen Follower

Join Date:
Feb 2008
Location:
Philadelphia
Posts:
292
Plugin Contributions:
2

Re: Add to office use only in confirm email to admin

I am having no luck on this. I see no customer table calls of note so I added a customers query from another thread on same topic which I followed to letter and got noplace which is why I am still at this.

In orders.php most files are coming from orders or address book neither of which contain the extrafield data as it's in customers.

So I added on line 940
//extra fields addition
global $db;
$extra_query ="select customers_extrafield, customers_extrafield2, customers_extrafield3, customers_extrafield4, customers_extrafield5 from ".TABLE_CUSTOMERS." WHERE customers_id = '".$_SESSION['customer_id'] ."'";
$extra_field = $db->Execute($extra_query);
$extra_field->fields['customers_id'];

no errors are thrown and orders process fine but the data does not appear on the email. I tried putting it in top portion of email below the customers name to keep it simple and no joy.

Can you point me a bit closer?

14 Dec 2013, 7:44 PM
#6
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Add to office use only in confirm email to admin

I almost need to see your site/code at this point.

If the data is being passed to the database inside the new field, then you should be able to see it when it's called for.

Is there data being recorded in the db?

14 Dec 2013, 8:06 PM
#7
jimmyv avatar

jimmyv

Zen Follower

Join Date:
Feb 2008
Location:
Philadelphia
Posts:
292
Plugin Contributions:
2

Re: Add to office use only in confirm email to admin

I am using the extra fields plugin. The data is written to the database either using the my account function or on registration it does load cleanly. The orders.php file has no modifications to it yet so it's a clean 1.5.1 orders.php.

What I want to do is get the data into the admin email and not the client email for this particular field located under customers table. Since I have not gotten it working it's not actual in use anyplace. I can get it to post a note in the line but the db data does not show after.

Looking at orders.php virtually all the db queries are not from customers. In fact using ++ I found only one customers pull and added it there got nothing. So I added this global from another thread on this exact topic

http://www.zen-cart.com/showthread.php?206773-Adding-extra-fields-to-admin-copy-of-order-confirmation-email-and-orders-area/page2

If I do the instruction in this thread it doesn't work either. Should that method work? The end result of that thread seems to have typos in it so I did it their way and removing a typo or two and various tweaks and this also doesn't work.

19 Mar 2014, 7:36 PM
#8
richardtuttle avatar

richardtuttle

New Zenner

Join Date:
Dec 2011
Location:
Boise, ID
Posts:
28
Plugin Contributions:
0

Re: Add to office use only in confirm email to admin

Did anyone ever get a solution to this problem? I am attempting to do the same thing right now and it's not working. :(

JimmyV:

I am using the extra fields plugin. The data is written to the database either using the my account function or on registration it does load cleanly. The orders.php file has no modifications to it yet so it's a clean 1.5.1 orders.php.

What I want to do is get the data into the admin email and not the client email for this particular field located under customers table. Since I have not gotten it working it's not actual in use anyplace. I can get it to post a note in the line but the db data does not show after.

Looking at orders.php virtually all the db queries are not from customers. In fact using ++ I found only one customers pull and added it there got nothing. So I added this global from another thread on this exact topic

http://www.zen-cart.com/showthread.php?206773-Adding-extra-fields-to-admin-copy-of-order-confirmation-email-and-orders-area/page2

If I do the instruction in this thread it doesn't work either. Should that method work? The end result of that thread seems to have typos in it so I did it their way and removing a typo or two and various tweaks and this also doesn't work.