Here's the basic concept --- you'll have to work out your own way of determining what the line-manager's email address is. You didn't mention how the store would know the correct email address. Simply add that logic into the code below.
1. /includes/classes/observers/class.sendLineManagerOrderNotices.php
PHP Code:
<?php
/**
* observer class to send custom extra order emails
*
* @package classes
* @copyright Copyright 2003-2013 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: class.sendLineManagerOrderNotices.php $
*/
class sendLineManagerOrderNotices extends base {
/** constructor method !
*
* Attach observer class to the global $zco_notifier and watch for a single notifier event.
*/
function __construct() {
$this->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));
}
/** Actual Method that does the desired activity
*
* Called by observed class when any of the notifiable events occur
*
* @param object $class
* @param string $eventID
* @param array $paramsArray
*/
function update(&$class, $eventID, $paramsArray = array()) {
list($zf_insert_id, $email_order, $extra_info, $html_msg) = $paramsArray;
$manager_email_address = $this->lookup_manager_email_address($_SESSION['customer_id']);
if ($manager_email_address != '') {
zen_mail('', $manager_email_address,
EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra');
}
}
function lookup_manager_email_address($employee_id) {
global $db;
$sql = "put your SQL query here -- needs to look up the destination manager's email address based on supplied $employee_id"
$result = $db->Execute($sql);
$email_address = $result->fields['manager_email'];
return $email_address;
}
}
2. /includes/auto_loaders/config.sendLineManagerOrderNotices.php
PHP Code:
<?php
/**
* autoloader activation point for custom group order email notices
*
* @package initSystem
* @copyright Copyright 2003-2013 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: config.sendLineManagerOrderNotices.php $
*/
/**
* Autoloader to instantiate observer class
*/
$autoLoadConfig[90][] = array('autoType'=>'class',
'loadFile'=>'observers/class.sendLineManagerOrderNotices.php');
$autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
'className'=>'sendLineManagerOrderNotices',
'objectName'=>'sendLineManagerOrderNotices');
Adapted from http://www.zen-cart.com/showthread.p...507#post889507 ... which may also be worth a read
Bookmarks