You are here

function uc_shipping_order_pane_packages in Ubercart 6.2

Same name and namespace in other branches
  1. 5 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()

Shipping order pane callback.

See also

uc_shipping_order_pane()

1 string reference to 'uc_shipping_order_pane_packages'
uc_shipping_order_pane in shipping/uc_shipping/uc_shipping.module
Implements hook_order_pane().

File

shipping/uc_shipping/uc_shipping.module, line 589

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]['data'] = $shipment->carrier;
          $tracking[$shipment->carrier]['children'][] = check_plain($shipment->tracking_number);
        }
        else {
          foreach ($shipment->packages as $package) {
            if ($package->tracking_number) {
              $tracking[$shipment->carrier]['data'] = $shipment->carrier;
              $tracking[$shipment->carrier]['children'][] = check_plain($package->tracking_number);
            }
          }
        }
      }
      return theme('item_list', $tracking);
      break;
  }
}