Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    892
    Plugin Contributions
    4

    Default Order class notifiers

    In /includes/classes/order.php the notifiers have been changed from using...
    PHP Code:
    $zco_notifier->notify(); 
    ...to...
    PHP Code:
    $this->notify(); 
    This makes the code look cleaner but doesn't it make the notifiers unusable? My understanding is that to use these notifiers you would now have to attach the observers to the order object. However the order object isn't created until after all the auto-loaders have finished loading.

    Am I missing something? Is there now a way to attach an observer to the order object, or even the order classs?

    Regards,
    Christian.

  2. #2
    Join Date
    Jan 2004
    Posts
    59,807
    Blog Entries
    4
    Plugin Contributions
    133

    Default Re: Order class notifiers

    That's very intentional, as it now makes the notifiers in the order class actually work
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,769
    Blog Entries
    1
    Plugin Contributions
    1

    Default 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.

  4. #4
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    892
    Plugin Contributions
    4

    Default 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.

  5. #5
    Join Date
    Jan 2004
    Posts
    59,807
    Blog Entries
    4
    Plugin Contributions
    133

    Default 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'));
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Jan 2004
    Posts
    59,807
    Blog Entries
    4
    Plugin Contributions
    133

    Default 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.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Use Of Notifiers - How To
    By milosh in forum General Questions
    Replies: 32
    Last Post: 1 Dec 2010, 11:04 AM
  2. Stumped on notifiers, help?
    By s_mack in forum General Questions
    Replies: 6
    Last Post: 8 Sep 2006, 11:34 PM
  3. Using notifiers
    By Arasii in forum General Questions
    Replies: 4
    Last Post: 11 Aug 2006, 02:39 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •