Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. class Order {
  4.  
  5. public $_order;
  6.  
  7. public function __construct( $order_id ) {
  8.  
  9. if ( empty( $order_id ) ) {
  10. throw new Exception( '$order_id empty' );
  11. }
  12.  
  13. $this->_order = $this->get( $order_id );
  14.  
  15. }
  16.  
  17. function get( $order_id ) {
  18.  
  19. global $wpdb;
  20.  
  21. $table_name = $wpdb->base_prefix . 'orders';
  22.  
  23. $orders = $wpdb->get_row( "SELECT * FROM $table_name WHERE order_id = " . $order_id, ARRAY_A );
  24.  
  25. return $order;
  26.  
  27. }
  28.  
  29. function get_total() {
  30.  
  31. return $this->_order['total'];
  32.  
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement