Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,696
    Plugin Contributions
    123

    Default Changes to NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL

    In 1.5.4 and below, this notifier is called with an array. In 1.5.4, see includes/classes/order.php line 1099.
    In 1.5.5a, the array was removed and the parameters were just added individually.

    Why was this change made?
    How could this have been better documented?
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,492
    Plugin Contributions
    88

    Default Re: Changes to NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL

    @swguy, it's not a matter of documentation since changing the parameters to a notify action is like changing the parameters to a function (with the associated fall-out for any plugins).

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,696
    Plugin Contributions
    123

    Default Re: Changes to NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL

    I understand how to change the parameters to a function. I'm just suggesting that the change be announced. In this case, I had to discover it by tedious debugging, since this unannounced change broke my logic.

    In fact, a change to a function call would have been preferable because that would immediately lead to a debug log for parameter incompatibility. In this case, no such log was issued.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Changes to NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL

    Quote Originally Posted by swguy View Post
    In 1.5.4 and below, this notifier is called with an array. In 1.5.4, see includes/classes/order.php line 1099.
    In 1.5.5a, the array was removed and the parameters were just added individually.

    Why was this change made?
    Passing data as an array leaves it immutable, but passing data as params 2-9 allow the var to be altered and the changes passed back to the calling code (if received into the observer by reference).
    When passing notifier parameters nowadays I usually put the immutable item (such as order-id) that shouldn't be allowed to change as the first data param, and then additional data points as subsequent params so that they can be received-by-reference in case it makes sense for them to be changed.

    In the case of NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL it's almost negligible either way, but I imagine it got changed for the sake of consistancy while others were being added/updated in that same class.
    .

    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.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,696
    Plugin Contributions
    123

    Default Re: Changes to NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL

    With respect, I think this was an error that should be avoided in future updates.

    I am baffled by your first assertion. Function arguments are passed by value in PHP. You can't change the value of a parameter unless you precede it by &. They are immutable by default.

    Making a *breaking change* for the purpose of consistency is really not a great tradeoff.
    What's the value of consistency vs the value of having things work predictably?

    And here's the thing: this is not even a consistent change! Lines 886 and 1085 also pass arguments as an array.

    Here's my point: the notifiers were introduced as a way of making it possible for people to make modifications without changing core files. But if you can't count on the notifiers working consistently from release to release, why would you use them? It's not like I'm using a private API or something - this is the public interface to Zen Cart.

    If you were to create new notifiers using a standard pattern (pass args by array or whatever) and deprecate the old ones over a series of releases with supporting documentation indicating how to upgrade, and then change the major number of the release (since it's a breaking change), well, that would be consistent with how commercial SDKs are updated over time. I'm just saying that it's not reasonable to willy-nilly change the way a program interface works based on your evolving design preferences.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

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

    Default Re: Changes to NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL

    Point well made.

    Apologies for the inconvenience that the change has evidently caused you.
    .

    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.

 

 

Similar Threads

  1. v150 product changes
    By Kathy_ in forum Customization from the Admin
    Replies: 2
    Last Post: 2 May 2012, 06:59 AM
  2. Changes in 1.3.9e
    By philip937 in forum General Questions
    Replies: 6
    Last Post: 4 Aug 2010, 06:06 PM
  3. ADMIN title changes versus regular title changes
    By muah in forum General Questions
    Replies: 0
    Last Post: 30 Jun 2009, 07:45 PM

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