Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34
  1. #11
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How can I "do something" after a successful PPE order?

    OOOHhh... OK, so the last bit of the constant, is that the page name? That makes sense. I was reading it more as a description of the event. So when we're talking about NOTIFY_HEADER_START_CHECKOUT_SUCCESS, is that saying "I'm notifying that the header for checkout_success has started"?

    Perhaps not though, because what page would the one I chose relate to?

    NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES

    I chose that one because I figured that any code relating to handling affiliates, which is normally determined on actual sales, that it would be least likely to be affected by reloads and such.

    Thanks for help and suggestions folks.

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

    Default Re: How can I "do something" after a successful PPE order?

    The notifier constants are just that -- string constants. You can normally infer the page (or class) from which they're issued by the name ... but not always.

  3. #13
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: How can I "do something" after a successful PPE order?

    Quote Originally Posted by lat9 View Post
    I'd lean more towards a notifier within the checkout_process path. The checkout_success page can be refreshed, resulting in your processing being re-run.
    Good point. This potential problem is/was mitigated in the ec_analytics module via a test of one of the session variables (that gets unset after the 1st page load).

    Cheers
    RodG

  4. #14
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: How can I "do something" after a successful PPE order?

    Quote Originally Posted by s_mack View Post
    So when we're talking about NOTIFY_HEADER_START_CHECKOUT_SUCCESS, is that saying "I'm notifying that the header for checkout_success has started"?.
    Correct.

    Quote Originally Posted by s_mack View Post
    NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES

    I chose that one because I figured that any code relating to handling affiliates, which is normally determined on actual sales, that it would be least likely to be affected by reloads and such.

    Thanks for help and suggestions folks.
    OK, so I haven't done a complete analysis of the program flow through all the checkout variances, but having just taken a quick review of things, the notifier you chose is probably a better option than the one I chose for ec_analytics.

    I suspect that I never even considered this option under the assumption it would only be triggered for affiliate related sales and not for *all* sales.

    FWIW, you/we don't need to limit ourselves to using these pre-defined hooks, it is actually quite a trivial task to create and use our own in pretty much any place in the ZenCart code, for almost any purpose. Alas, for this to work does require a very minor change to the existing code to add the 'hook', and in my opinion this defeats the most significant reason for using the notifiers in the 1st place.

    On a slightly different note:
    Does anyone here know of any reason, circumstance or situation where the checkout success page *wouldn't* be loaded (after a successful checkout)? The reason I ask is because I've had the rare report that not all sales are being tracked by the ec module (I've not been able to confirm or replicate) - and about the only cause I can think of is if this success page is somehow being bypassed or skipped.

    If this theoretically possible?

    Cheers
    RodG

  5. #15
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How can I "do something" after a successful PPE order?

    Over the years, with just the stock checkout, I've had a few extremely rare cases (maybe 3 in 10,000) where a payment went through but the order was never recorded. I don't know if that would coincide with what your users experienced but thought I'd mention it.

    So adding hooks is really as simple as just placing a $zco_notifier->notify('WHATEVER'); where convenient for us? I figured each hook was actually registered somewhere but I never really looked.

    I *try* to avoid core over-writes as much as possible. I really appreciate the idea behind the overrides, observers, etc... but the fact is no matter how hard I try I always end up extensively modding the core. In practice, the overrides system is limited. It would be greatly enhanced if "pages" could be overridden, and also functions (or, if functions were held to a stricter standard of not including any html output).

    Of course, that's off topic.

    This topic, we can consider closed from my perspective. They way I did it in post #5 is working just fine. I will change the initiation (or whatever its called) from 180 to "above 199" if that's considered good form. I don't think it makes a difference for my purposes.

    Thanks for the assistance and tips, folks.

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

    Default Re: How can I "do something" after a successful PPE order?

    Quote Originally Posted by s_mack View Post
    ...
    I *try* to avoid core over-writes as much as possible. I really appreciate the idea behind the overrides, observers, etc... but the fact is no matter how hard I try I always end up extensively modding the core. In practice, the overrides system is limited. It would be greatly enhanced if "pages" could be overridden, and also functions (or, if functions were held to a stricter standard of not including any html output).
    ...
    Me too! Take RodG's advice, though: If you don't see a notifier that's placed where you need it or one that serves up the data you need, add that notifier (a 1-line change, plus comments) to the core file and then do your special processing in the observer-level code. It serves to compartmentalize the changes and makes upgrading a whole lot easier!

    Never, ever modify the data payload of a built-in notifier, you'd be asking for a world of hurt when the next version of Zen Cart re-purposes that notifier with different data!

  7. #17
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How can I "do something" after a successful PPE order?

    Quote Originally Posted by lat9 View Post
    Never, ever modify the data payload of a built-in notifier
    Can you explain what that means so I can know exactly what not to do? :)

    edit: actually, I think I do know what you're referring to... so a better question is how do I know what notifiers provide what data?

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

    Default Re: How can I "do something" after a successful PPE order?

    Sorry to be obtuse! If you look at the structure of a ->notify function call (Zen Cart v1.5.2 and later), that call takes a (required) string notifier and from 1 to 9 additional parameters. The first additional parameter is a read-only value while parameters 2-9 are read/write.

    I'm calling those optional parameters the payload.

    Let's say that you've looked at /includes/classes/order.php and determined that you'd like to hook the notification:
    Code:
         $this->notify('NOTIFY_ORDER_CART_ADD_PRODUCT_LIST', array('index'=>$index, 'products'=>$products[$i]));
    For whatever reason, you'd like the value of $rowClass to be included. What I'm suggesting is is that it's bad form to modify the order.php class to change that notifier to add the $rowClass value because the next version of Zen Cart might choose to update that data payload:
    Code:
         $this->notify('NOTIFY_ORDER_CART_ADD_PRODUCT_LIST', array('index'=>$index, 'products'=>$products[$i]), $rowClass);
    Instead, since you're editing the file anyway, add a totally new notifier for your use that you control:
    Code:
         $this->notify('NOTIFY_ORDER_CART_ADD_PRODUCT_LIST_LAT9', array('index'=>$index, 'products'=>$products[$i]), $rowClass);

  9. #19
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: How can I "do something" after a successful PPE order?

    Crystal clear, thank you.

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

    Default Re: How can I "do something" after a successful PPE order?

    Quote Originally Posted by s_mack View Post
    /includes/auto_loaders/config.myProcessor.php
    Code:
    <?php
      $autoLoadConfig[10][] = array('autoType'=>'class',
                                     'loadFile'=> 'observers/class.myProcessor.php');
      $autoLoadConfig[180][] = array('autoType'=>'classInstantiate',
                                  'className'=>'myProcessor',
                                  'objectName'=>'myProcessor');
    ?>
    I'm especially unsure on the values I used for autloading (10 and 180). I went with 10 because the wiki used that for its example and I used 180 because PayPal uses up to 170 in paypal_ipn.core.php but really I don't understand it enough to say that was an informed guess.
    Since the autoLoadConfig array is processed, and all its loads/requires/instantiations are executed during application_top, the actual "order" of loading your custom added observer classes is moot, save for the fact that yours should typically be above 200. The "order" is used only to ensure necessary prerequisites are handled, such as starting sessions before running init scripts that require the use of sessions, and starting the db before the db is needed, etc. That's all done below 200, and all your userland stuff should typically be done after 200. Additionally, you probably already grok this, but I'll state it to be clear: do your loadFile directive before your classInstantiate, and you're good. (And, yes, doing loadFile directives below 200 is fine, but equally fine to do above 200, as long as they're done before instantiating)
    .

    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 4 FirstFirst 1234 LastLast

Similar Threads

  1. v154 How can I change the text in shipping estimator from "Best Way" to something else?
    By Zappa Aviaries in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 11 Feb 2015, 05:10 AM
  2. v150 can't seem to unzip on download "open" or after "save"
    By cyberbaffled in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 6 Apr 2012, 03:37 AM
  3. How to remove ellipses ("...") after "All Products" and "New Products" on home page?
    By jthurman in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 May 2010, 03:30 PM
  4. blank page after "successful" install on remote server
    By alnaad in forum General Questions
    Replies: 2
    Last Post: 22 Jul 2009, 05:35 PM
  5. Anyone successful make the "Group Pricing (Per Item)" & "MSRP Display" togther?
    By explorer1979 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 12 Dec 2008, 08:37 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