Colorado Timberline APIA Practical Guide to Successful Integration

OrderShipped Notification

Just implement the hook for the OrderShipped notification.

class CtOrderShippedCallback extends CtApiCallback
    * the key here is you have a pre-hydrated CtOrderShipped
    * instance to work with; it should be easy to integrate..

    protected static function _execute(CtOrderShipped $oDao)
          // store relevant info in the db; imagine Propel data access layer
          // hydrate the order from the db, using the order no from notification
          $c = new Criteria();
          $c->add(OrderPeer::ID, $oDao->getCustomerPoNo());
          $oOrder = OrderPeer::doSelectOne($c);

          // now update some tracking info on the order
          // supposing you stored that in the order table ..
          $oOrder->save();  // update record in db

          // now you might want to send a mail to the user
          // lookup user via order number .., compose mail
          mail($sUserEmail, 'Order Shipped!',
                  $sOrderShippedMsg, $sOrderShippedHeaders);