Originally Posted by
DrByte
Change the SQL query to retrieve the appropriate destination email address, instead of doing customer-group lookup.
Am I going in the right direction?
PHP Code:
<?php
/**
* observer class to send custom extra order emails to referring clinic/doctor
*
* @package classes
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: class.sendReferralOrderNotices.php 2010-05-26 20:05:22Z drbyte $
*/
class sendReferralOrderNotices extends base {
/** constructor method !
*
* Attach observer class to the global $zco_notifier and watch for a single notifier event.
*/
function sendReferralOrderNotices() {
$this->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));
/**
* Set the email subject line for the messages being sent to the external supplier
* Use EMAIL_TEXT_SUBJECT for the default subject, or replace with 'My Custom Subject Line' instead.
*/
$this->orderEmailSubjectPrefix = 'Order Fulfillment Request from ' . STORE_NAME;
}
/** Actual Method that does the desired activity
*
* Called by observed class when any of the notifiable events occur
*
* @param object $class
* @param string $eventID
*/
function update(&$class, $eventID, $paramsArray = array()) {
global $db;
list($zf_insert_id, $email_order, $extra_info, $html_msg) = $paramsArray;
//$group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
$referral_query = $db->Execute("SELECT sources.sources_email AS sources_email
FROM sources INNER JOIN customers ON sources.sources_id = customers.customers_info_source_id
WHERE customers.customers_id = '" . (int)$_SESSION['customer_id'] . "'");
//if (!$referral_query->EOF && $referral_query->fields['customers_group_pricing'] == $this->specialReferralId) {
if (!$referral_query->EOF) {
$this->specialReferralEmailAddress = $referral_query->fields['sources_email'];
zen_mail('', $this->specialReferralEmailAddress,
$this->orderEmailSubjectPrefix . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
}
}
}
Sorry I'm relatively new to zen cart. Thank you for your help.
Bookmarks