Page 1 of 4 123 ... LastLast
Results 1 to 10 of 34
  1. #1
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

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

    This may not be the best place to ask this, but I'll try here first.

    When an order is placed and it is successful, the order is taken from Pending to Processing automagically whether or not I'm logged in to see it (if a tree falls in the for forest...)

    How can I get I add to the functionality at that stage?

    Basically I want to trigger some other code at that point in time. So when a successful order comes in, do "this". How do I hook into that event, so to speak?

    Clues?

  2. #2
    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?

    I'm thinking it has something to do with $zco_notifier->notify('NOTIFY_, but which one?

    I'm digging now, so really this is just a "if you happen to know, tell me" kind of Q :)

  3. #3
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

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

    At what point in the overall checkout process do you want to do something, what is the something you want to do (more importantly what data at or after that point do you need. Also for what version(s) of ZC are you developing for?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    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?

    Hi MC. Thanks for the reply.

    The point I'm after is "success"... the point where the order is considered complete and paid for.

    The something I want to do is automatically send the shipping details to the shipping service API. Data I need are the order details (specifically: delivery address, phone number, model and quantities of cart items, shipping service, amount paid for shipping, currency used, order number. I think that's it)

    ZC 1.5.4

  5. #5
    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?

    So here's what I've done so far:

    /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');
    ?>
    /includes/classes/observers/class.myProcessor.php
    Code:
    <?php
    
    class myProcessorextends base {
    
      function __construct() {
        $this->attach($this, array('NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES'));
      }
    
      function update(&$class, $eventID, $paramsArray = array())
      {
        if ($eventID == 'NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES')
        {
        //DO SOMETHING
        }
      }
    }
    It seems to be working. What I'm not sure on is if "NOTIFY_CHECKOUT_PROCESS_HANDLE_AFFILIATES" is appropriate (I used it because it appeared to be around the right place in the code for tapping in) and 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.

  6. #6
    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?

    as far as the "do something", that would be a SOAP exchange with the shipper's service as per their API and, upon receiving success, updating the order in the DP from 'processing' to 'shipped' and sending out an email. My next step is to make a cron-job that periodically poles the shipper's servers for tracking numbers (they aren't immediately available) and sending them to the customer when it is available. I'll either need a new DB table for that, or (perhaps simpler) add a status in between "processing" and "shipped".

    I hope to eventually also cron up a summary / audit system so the admin can be notified with info such as amount customer paid for shipping vs. amount we were ultimately charged (that too isn't known right away)

    Fun stuff.

  7. #7
    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
    The point I'm after is "success"... the point where the order is considered complete and paid for.
    NOTIFY_HEADER_START_CHECKOUT_SUCCESS

    ... is one suitable hook. I know there are others.

    This is the one I use in the ec_analytics module to trigger/send the transaction details of a sale to the Google servers, which is pretty much a similar thing to what you are wanting to do.

    Cheers
    Rod

  8. #8
    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?

    Ahh, I think I saw that but when I read "Start Checkout Success" I mistook as meaning the checkout process started successfully (ie. right after they click "checkout" in their cart). Thanks.

  9. #9
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

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

    I was also possibly going to suggest: NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL as a possibility, though it is "further" down the line in order processing.

    As for the trigger points of 10 and 180... There's a bit of various direction... In some cases it appears that it should be something like 0 and 199+, but then in ZC 1.5.3 there is a new auto load observer that loads at 175, and then there is the suggestion that none should be less than 199 without good reason (which means need to know and understand when to use which)... Don't see a problem with what has been used per se. And for the most part as long as it works. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,381
    Plugin Contributions
    94

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

    Quote Originally Posted by RodG View Post
    NOTIFY_HEADER_START_CHECKOUT_SUCCESS

    ... is one suitable hook. I know there are others.

    This is the one I use in the ec_analytics module to trigger/send the transaction details of a sale to the Google servers, which is pretty much a similar thing to what you are wanting to do.

    Cheers
    Rod
    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.

 

 
Page 1 of 4 123 ... 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