Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18
  1. #11
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Adding custom notifiers

    I'm guessing you're wanting to hook into the same spot where NOTIFY_ADMIN_CUSTOMERS_B4_ADDRESS_UPDATE is triggered in v1.5.6?
    Ref: https://github.com/zencart/zencart/pull/1534/files
    If so may as well add that specific line to your current code, to make your eventual upgrade a little easier.

    As for making the Admin load and run the observer class, what was the fatal error you got in your last post?

    You *do* want your observer classes to "extends base".
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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.

  2. #12
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: Adding custom notifiers

    Quote Originally Posted by Dave224 View Post
    Sorry everyone...I'm in procedural code, so I deleted "extends base", and went back to zco_notifier->attach... With mc12345678 addition, i now get a fatal error, so I deleted that code too. No errors, but update is still not executing.
    To be pedantic as I've been called:

    Did you actually use:
    Code:
    zc_notifier->attach
    or:
    Code:
    $zc_notifier->attach
    And there is/was no need to "go back".

    And further as "now" identified in the above post, the additional $autoLoadDefault is necessary as specifically identified in this portion of the associated docs: https://docs.zen-cart.com/dev/code/n...observer-class
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #13
    Join Date
    Jun 2012
    Posts
    406
    Plugin Contributions
    0

    Default Re: Adding custom notifiers

    DrByte,
    I need the notifier after the address book update. It would be helpful if the documentation made it clear that within procedural code notify observers, that "extends base" in the class name is required in the attach description. The confusing point is in the procedural code notify description where it says: "In procedural code, functions and classes that don’t extend base, use the global $zco_notifier object to issue events."
    Thank you for the great support and outstanding program.
    Dave

  4. #14
    Join Date
    Jun 2012
    Posts
    406
    Plugin Contributions
    0

    Default Re: Adding custom notifiers

    Thanks for the information about future zc versions and additional parameters, but the problem remains...neither the store-side update method or store-side camelcase class name method will execute when notified from admin code, specifically admin/customers.php. Any other suggestions?
    Dave

  5. #15
    Join Date
    Jun 2012
    Posts
    406
    Plugin Contributions
    0

    Default Re: Adding custom notifiers

    Found an error when I put zco_notifier->attach... in the observer constructor. Looks like update method is being called now with the class being instantiated per mc12345678.
    Thanks all!
    Dave

  6. #16
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Adding custom notifiers

    Quote Originally Posted by Dave224 View Post
    DrByte,
    I need the notifier after the address book update. It would be helpful if the documentation made it clear that within procedural code notify observers, that "extends base" in the class name is required in the attach description. The confusing point is in the procedural code notify description where it says: "In procedural code, functions and classes that don’t extend base, use the global $zco_notifier object to issue events."
    Thank you for the great support and outstanding program.
    Dave
    Thanks for pointing that out.

    To clarify, that section was referring to what to write in application code "when adding notifier events to your application code", not when "writing code inside the observer class itself".

    I've made a note to do some updating.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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.

  7. #17
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: Adding custom notifiers

    Quote Originally Posted by DrByte View Post
    Thanks for pointing that out.

    To clarify, that section was referring to what to write in application code "when adding notifier events to your application code", not when "writing code inside the observer class itself".

    I've made a note to do some updating.
    DrByte, I had a minor suggestion for at least the sentence as provided to help those that don't necessarily understand that the grey formatting around the 'extend base' stands for the code expected as compared to the grammatical extends base: any classes that 'extend base'. But then there is the "risk" that the statement 'extend base' can be applied to procedural code and functions, so would recommend the sentence to start: "Procedural code, any classes that 'extend base' and functions..."

    I didn't get a chance yesterday to pose that as a PR, but thought it may be helpful to new "readers"...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #18
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Adding custom notifiers

    Quote Originally Posted by mc12345678 View Post
    DrByte, I had a minor suggestion for at least the sentence as provided to help those that don't necessarily understand that the grey formatting around the 'extend base' stands for the code expected as compared to the grammatical extends base: any classes that 'extend base'. But then there is the "risk" that the statement 'extend base' can be applied to procedural code and functions, so would recommend the sentence to start: "Procedural code, any classes that 'extend base' and functions..."

    I didn't get a chance yesterday to pose that as a PR, but thought it may be helpful to new "readers"...
    Done:

    "In procedural application code (actually, in any code that is not inside a class which `extends base`), use the global `$zco_notifier` object to trigger events."
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    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.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Adding custom function, calling custom code from pages.
    By madteckhead in forum General Questions
    Replies: 6
    Last Post: 14 Jun 2007, 08:24 AM
  2. 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR