You are here

function uc_shipping_shipment_view in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_shipping/uc_shipping.admin.inc \uc_shipping_shipment_view()
  2. 7.3 shipping/uc_shipping/uc_shipping.admin.inc \uc_shipping_shipment_view()

Display shipment details.

1 string reference to 'uc_shipping_shipment_view'
uc_shipping_menu in shipping/uc_shipping/uc_shipping.module
Implementation of hook_shipping_menu().

File

shipping/uc_shipping/uc_shipping.module, line 778
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_shipment_view($order_id, $sid) {
  $breadcrumb = drupal_get_breadcrumb();
  $breadcrumb[] = l(t('Shipments'), 'admin/store/orders/' . $order_id . '/shipments');
  drupal_set_breadcrumb($breadcrumb);
  $shipment = uc_shipping_shipment_load($sid);
  $output = '';
  $origin = uc_order_address($shipment, 'o');
  $destination = uc_order_address($shipment, 'd');
  $output .= '<div class="order-pane pos-left"><div class="order-pane-title">' . t('Pickup Address:') . '</div>' . $origin . '</div>';
  $output .= '<div class="order-pane pos-left"><div class="order-pane-title">' . t('Delivery Address:') . '</div>' . $destination . '</div>';
  $output .= '<div class="order-pane abs-left"><div class="order-pane-title">' . t('Schedule:') . '</div>';
  $rows = array();
  $rows[] = array(
    t('Ship date:'),
    format_date($shipment->ship_date, 'custom', 'D, ' . variable_get('uc_date_format_default', 'm/d/Y')),
  );
  $rows[] = array(
    t('Expected delivery:'),
    format_date($shipment->expected_delivery, 'custom', 'D, ' . variable_get('uc_date_format_default', 'm/d/Y')),
  );
  $output .= theme('table', array(), $rows, array(
    'style' => 'width:auto',
  ));
  $output .= '</div>';
  $output .= '<div class="order-pane abs-left"><div class="order-pane-title">' . t('Shipment Details:') . '</div>';
  $rows = array();
  $rows[] = array(
    t('Carrier:'),
    check_plain($shipment->carrier),
  );
  if ($shipment->transaction_id) {
    $rows[] = array(
      t('Transaction ID:'),
      check_plain($shipment->transaction_id),
    );
  }
  if ($shipment->tracking_number) {
    $rows[] = array(
      t('Tracking Number:'),
      check_plain($shipment->tracking_number),
    );
  }
  $methods = module_invoke_all('shipping_method');
  $method = $methods[$shipment->shipping_method];
  if (isset($method['quote']['accessorials'][$shipment->accessorials])) {
    $rows[] = array(
      t('Services:'),
      $method['quote']['accessorials'][$shipment->accessorials],
    );
  }
  else {
    $rows[] = array(
      t('Services:'),
      $shipment->accessorials,
    );
  }
  $rows[] = array(
    t('Cost:'),
    uc_currency_format($shipment->cost),
  );
  $output .= theme('table', array(), $rows, array(
    'style' => 'width:auto',
  ));
  $output .= '</div>';
  foreach ($shipment->packages as $package) {
    $output .= uc_shipping_package_view($package->package_id);
  }
  return $output;
}