tribulant

do_shipping()

Jan 12th, 2012
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. function do_shipping($order_id = null) {
  2.         global $wpdb, $wpcoDb, $wpcoShipmethod, $Item;
  3.        
  4.         if (empty($order_id)) {
  5.             $order_id = $this -> current_order_id();
  6.         }
  7.    
  8.         if ($this -> get_option('shippingcalc') == "Y") {
  9.             $shipmethodsquery = "SELECT id FROM " . $wpdb -> prefix . $wpcoShipmethod -> table . "";
  10.        
  11.             if ($shipmethods = $wpdb -> get_results($shipmethodsquery)) {          
  12.                 if (!empty($order_id)) {               
  13.                     $wpcoDb -> model = $Item -> model;
  14.                
  15.                     if ($items = $wpcoDb -> find_all(array('order_id' => $order_id))) {                
  16.                         foreach ($items as $item) {                        
  17.                             if (!empty($item -> product -> type)) {                            
  18.                                 if ($item -> product -> type == "tangible") {                                  
  19.                                     return true;
  20.                                 }
  21.                             }
  22.                         }  
  23.                     }
  24.                 }
  25.             }
  26.         }
  27.        
  28.         return false;
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment