Hey guys, trying to get my first Observer working.
I have placed the following in includes/auto_loaders/config.test_ordernum.php:
PHP Code:
$autoLoadConfig[0][] = array('autoType'=>'class',
'loadFile'=>'observers/class.test_observer.php');
$autoLoadConfig[0][] = array('autoType'=>'classInstantiate',
'className'=>'test_ordernum',
'objectName'=>'test_ordernum');
And I have placed the following in include/classes/observers/class.test_observer.php:
PHP Code:
class test_ordernum extends base {
function test_ordernum() {
$this->attach($this, array('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE'));
}
function update(&$class, $notifier, $paramsArray) {
global $db;
$sql = "INSERT INTO test_ordernum ( orders_id, ordernum) VALUES ('55','test')";
$result = $db->Execute($sql);
}
}
Now, I know for sure that the file is loading, because if I put some jacked up syntax in it, it errors out.
However, my problem is that that query is never running. I'm under the assumption that that is literally all I need in my class -- update should automatically be called when the notificaton is triggered.
Maybe it has something to do with the autoload "breakpoint"? I tried various levels, but no luck. Maybe theres some obvious syntax or reference issue (php is not forte, but I am in experienced in other languages)
Long story short, what I'm trying to do is create an alphanumeric order numer thats based on order date, and due to interfacing with a third party system, it is just easier to store it, instead of doing the display-hack that I've seen a lot of order number modifications do.
Any help is appreciated!
Bookmarks