I'm querying the db to add more detail to the order confirmation email. I'm only adding it to the admin "extra_info" email. I have the includes/functions/functions_email.php part working:
but I can't get the data I need to pass into it working in includes/classes/order.php. I'm sure it has to do with how my novice php skills are not getting the sql & php info right. This is what I've added into order.php:PHP Code:function email_collect_extra_info($from, $email_from, $login, $login_email, $login_phone='', $login_fax='', $login_heard_from='', $login_heard_from_other='') {
...
// generate footer details for "also-send-to" emails. Pulls data from includes\classes\order.php
$extra_info=array();
$extra_info['TEXT'] =
OFFICE_USE . "\t" . "\n" .
(trim($login) !='' ? OFFICE_LOGIN_NAME . "\t\t" . $login . "\n" : '') .
(trim($login_email) !='' ? OFFICE_LOGIN_EMAIL . "\t\t" . $login_email . "\n" : '') .
($login_phone !='' ? OFFICE_LOGIN_PHONE . "\t\t" . $login_phone . "\n" : '') .
($login_fax !='' ? OFFICE_LOGIN_FAX . "\t\t" . $login_fax . "\n" : '') .
(trim($login_heard_from) !='' ? OFFICE_LOGIN_HEARD_FROM . "\t\t" . $login_heard_from . "\n" : '') .
(trim($login_heard_from_other) !='' ? OFFICE_LOGIN_HEARD_FROM_OTHER . "\t" . $login_heard_from_other . "\n" : '') . "\n\n";
andPHP Code:$heard_from_query = "SELECT orders.orders_id, sources.sources_name, sources_other.sources_other_name FROM (((customers LEFT JOIN customers_info ON customers.customers_id = customers_info.customers_info_id) LEFT JOIN sources_other ON customers_info.customers_info_id = sources_other.customers_id) LEFT JOIN sources ON customers_info.customers_info_source_id = sources.sources_id) INNER JOIN orders ON customers.customers_id = orders.customers_id
where orders_id = '" . (int)$order_id . "'";
$heard_from = $db->Execute($heard_from_query);
Basically, I need to pass sources_name and sources_other_name into the email_collect_extra_info function. What am I doing wrong?PHP Code:// 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'], '', $heard_from->fields['sources_name'], $heard_from->fields['sources_other_name']);
$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 . "\n" . 'TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id . "\n\n";
$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'] . $pmt_details, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra');
}







Bookmarks