Oversimplified Example ("/includes/classes/observers/dosometingafterorder.php"). This will be triggered by checkout_process or PayPal IPN when an order is successfully added to the database:
Code:
class DoSomethingAfterOrder extends base {
function __construct() {
global $zco_notifier;
$zco_notifier->attach($this, array('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS'));
}
function update(&$class, $eventID, $paramsArray = array()) {
global $db;
$order_id = $_SESSION['order_number_created']; // May also be available in $GLOBALS['insert_id'];
// Do something with the order id and / or database
}
}
And the simplified autoloader file ("/includes/auto_loaders/config.dosometingafterorder.php":
Code:
$autoLoadConfig[10][] = array('autoType'=>'class',
'loadFile'=>'observers/dosometingafterorder.php' // File where the class is located
);
// 80 is where the shopping cart is established for the session
// 110 is where the language components are established for the session
$autoLoadConfig[115][] = array('autoType'=>'classInstantiate',
'className'=>'do_something_after_order', // Variable name accessible by in other files
'objectName'=>'DoSomethingAfterOrder' // Name of the class
);