Re: Order class notifiers
That's very intentional, as it now makes the notifiers in the order class actually work :blush:
Re: Order class notifiers
Just to expand on the above.
When you do something like
$this->attach($this, array('NOTIFY_ORDER_CART_ADD_PRODUCT_LIST'));
you are not actually attaching to the class the notifier exists in, you are merely setting a callback to your observer for when that notifier happens.
It is only when the notifier happens that the class that the notifier exists in is passed to your observer classes update method.
Re: Order class notifiers
Hi,
Thanks for the replies. Sorry if I'm being a bit stupid but I still don't quite understand. I'm used to attaching notifiers like...
PHP Code:
$_SESSION['cart']->attach($this, array('NOTIFIER_CART_ADD_CART_END'));
$zco_notifier->attach($this, array('NOTIFY_HEADER_END_CHECKOUT_CONFIRMATION'));
How would I now do a similar thing with the notifiers in the order class code?
Do I just create my own order object and use that to attach the notifiers?
Many thanks,
Christian.
Re: Order class notifiers
Example:
In the order class, there's a notifier point NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL.
So, to hook it, I simply use:
Code:
$this->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));
Re: Order class notifiers
You'll use the $this->attach() method to hook notifier points that are inside a class.
You'll use the $zco_notifier->attach() method to hook notifier points that are NOT inside a class.
Re: Order class notifiers
Note also,
Attaching to the cart class is slightly different because of the fact that the instantiated object is stored in the session.
Re: Order class notifiers
Quote:
Originally Posted by
DrByte
You'll use the $this->attach() method to hook notifier points that are inside a class.
You'll use the $zco_notifier->attach() method to hook notifier points that are NOT inside a class.
Quote:
Originally Posted by
wilt
Attaching to the cart class is slightly different because of the fact that the instantiated object is stored in the session.
Thank you both for your help. I think it was the cart class example that was confusing me. I assumed the other observers had to be attached to specific instantiated objects.
Many thanks,
Christian.