Guest User

Untitled

a guest
Jun 18th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * SendXMLEmail class sends an email to the site admin when an order is finished
  5. * this email will contain XML for him to relay to the framing service site
  6. */
  7.  
  8. class SendXMLEmail extends base {
  9.  
  10. function SendXMLEmail() {
  11. //$this->attach($this, array('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL'));
  12.  
  13. /**
  14. * This is the debug event handler it will trigger every time you add something to a cart
  15. *
  16. **/
  17. $_SESSION['cart']->attach($this, array('NOTIFIER_CART_ADD_CART_END'));
  18. }
  19.  
  20.  
  21. function update(&$class, $eventID) {
  22.  
  23. /**
  24. * Check for some common error conditions
  25. * $order_id = 68 for testing purposes
  26. */
  27.  
  28. if ( ! $order_id)
  29. {
  30. error_email("No Order");
  31. }
  32.  
  33. if ( ! is_numeric($order_id))
  34. {
  35. error_email("Order ID is not numeric");
  36. }
  37.  
  38.  
  39. /**
  40. * Boilerplate zen cart database query.
  41. * Note, i'm trusting the stored data (it's from another php script with no user input
  42. * and i'm certain there can be only one row
  43. */
  44.  
  45. global $db;
  46. $sql = "SELECT comments
  47. FROM order_status_history
  48. WHERE orders_id = $order_id;";
  49. $result = $db->Execute($sql);
  50.  
  51. if ($result->RecordCount() == 0)
  52. {
  53. error_email("Order Not Found");
  54. }
  55.  
  56. if ($result->RecordCount() > 1)
  57. {
  58. error_email("Too many order id's returned, this should be impossible");
  59. }
  60.  
  61. //echo $result->fields['comments'];
  62. //echo "foofoofoo";
  63.  
  64. }
  65.  
  66. }
  67.  
  68. function error_email($message) {
  69. // echo $message;
  70. }
  71. ?>
Add Comment
Please, Sign In to add comment