New Install - 1.5.3
I have a requirement to send additional order confirmation & order update emails to manufacturers whose products have been ordered.
I added manufacturers_name & manufacturers_email to order_products table and changed insert in includes/classes/order.php and data is being populated correctly when order is saved.
I also changed admin/orders.php to send additional email to manufacturers whenever order is updated and this is also working correctly.
But I am having a problem sending additional email to manufacturers from includes/classes/order.php
I have changed the "send additional emails" section in function send_order_email() as follows
(new code I added is shown in red)
php error I'm getting on db->Execute is:
12-Oct-2014 16:24:19 UTC] PHP Fatal error: Call to a member function Execute() on a non-object in C:\Development\wamp\www\store\includes\classes\order.php on line 1107
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']); $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']; } // Add extra heading stuff via observer class $this->extra_header_text = ''; $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_FOR_ADDITIONAL_EMAILS', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg)); $email_order = $this->extra_header_text . $email_order; $html_msg['EMAIL_TEXT_HEADER'] = nl2br($this->extra_header_text) . $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, $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address']); // get manufacturers_email from orders_products and send additional emails $manufacturers = $db->Execute("select distinct manufacturers_email from " . TABLE_ORDERS_PRODUCTS . " where orders_id = " . (int)$zf_insert_id ); while (!$manufacturers->EOF) { $sendExtraEmails = $manufacturers->fields['manufacturers_email']; zen_mail('', $sendExtraEmails, 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->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address']); $manufacturers->MoveNext(); } // end of extra manufacturers_email }
the code I added into admin/orders.php that works is below:
If anyone can point me in the right direction to correct this error, I'd appreciate it.Code://send extra emails if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') { zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra'); // get manufacturers_email from orders_products and send extra emails $manufacturers = $db->Execute("select distinct manufacturers_email from " . TABLE_ORDERS_PRODUCTS . " where orders_id = " . (int)$oID ); while (!$manufacturers->EOF) { $sendExtraEmails = $manufacturers->fields['manufacturers_email']; zen_mail('', $sendExtraEmails, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra'); $manufacturers->MoveNext(); } // }


Reply With Quote

