You are here

function uc_shipping_order_pane_packages in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_shipping/uc_shipping.module \uc_shipping_order_pane_packages()
  2. 7.3 shipping/uc_shipping/uc_shipping.module \uc_shipping_order_pane_packages()
1 string reference to 'uc_shipping_order_pane_packages'
uc_shipping_order_pane in shipping/uc_shipping/uc_shipping.module

File

shipping/uc_shipping/uc_shipping.module, line 1319
Organizes ordered products into packages and sets them up for shipment. Shipping method modules may add functionality to generate shipping labels and tracking numbers.

Code

function uc_shipping_order_pane_packages($op, $arg1) {
  switch ($op) {
    case 'view':
    case 'customer':
      $tracking = array();
      $result = db_query("SELECT sid FROM {uc_shipments} WHERE order_id = %d", $arg1->order_id);
      while ($shipment = db_fetch_object($result)) {
        $shipment = uc_shipping_shipment_load($shipment->sid);
        if ($shipment->tracking_number) {
          $tracking[$shipment->carrier]['children'][] = check_plain($shipment->tracking_number);
        }
        else {
          foreach ($shipment->packages as $package) {
            if ($package->tracking_number) {
              $tracking[$shipment->carrier]['children'][] = check_plain($package->tracking_number);
            }
          }
        }
      }
      $output = '';
      foreach ($tracking as $carrier => $item) {
        $output .= '<strong>' . $carrier . ':</strong>' . theme('item_list', $item);
      }
      return $output;
      break;
  }
}