You are here

function theme_uc_ups_confirm_shipment in Ubercart 8.4

Same name and namespace in other branches
  1. 5 shipping/uc_ups/uc_ups.module \theme_uc_ups_confirm_shipment()
  2. 6.2 shipping/uc_ups/uc_ups.ship.inc \theme_uc_ups_confirm_shipment()
  3. 7.3 shipping/uc_ups/uc_ups.ship.inc \theme_uc_ups_confirm_shipment()

Displays final shipment information for review.

See also

uc_ups_confirm_shipment()

1 string reference to 'theme_uc_ups_confirm_shipment'
uc_ups_theme in shipping/uc_ups/uc_ups.module
Implements hook_theme().

File

shipping/uc_ups/src/Plugin/Ubercart/FulfillmentMethod/uc_ups.ship.inc, line 571
UPS functions for label generation.

Code

function theme_uc_ups_confirm_shipment(array $variables) {
  $form = $variables['form'];
  $output = '<div class="shipping-address"><b>' . t('Ship from:') . '</b><br />';
  $address = new Address();
  $address->first_name = SafeMarkup::checkPlain($_SESSION['ups']['origin']->first_name);
  $address->last_name = SafeMarkup::checkPlain($_SESSION['ups']['origin']->last_name);
  $address->company = SafeMarkup::checkPlain($_SESSION['ups']['origin']->company);
  $address->street1 = SafeMarkup::checkPlain($_SESSION['ups']['origin']->street1);
  $address->street1 = SafeMarkup::checkPlain($_SESSION['ups']['origin']->street2);
  $address->city = SafeMarkup::checkPlain($_SESSION['ups']['origin']->city);
  $address->zone = SafeMarkup::checkPlain($_SESSION['ups']['origin']->zone);
  $address->postal_code = SafeMarkup::checkPlain($_SESSION['ups']['origin']->postal_code);
  $address->country = SafeMarkup::checkPlain($_SESSION['ups']['origin']->country);
  $output .= (string) $address;
  $output .= '<br />' . SafeMarkup::checkPlain($_SESSION['ups']['origin']->email);
  $output .= '</div>';
  $output .= '<div class="shipping-address"><b>' . t('Ship to:') . '</b><br />';
  $address = new Address();
  $address->first_name = SafeMarkup::checkPlain($_SESSION['ups']['destination']->first_name);
  $address->last_name = SafeMarkup::checkPlain($_SESSION['ups']['destination']->last_name);
  $address->company = SafeMarkup::checkPlain($_SESSION['ups']['destination']->company);
  $address->street1 = SafeMarkup::checkPlain($_SESSION['ups']['destination']->street1);
  $address->street1 = SafeMarkup::checkPlain($_SESSION['ups']['destination']->street2);
  $address->city = SafeMarkup::checkPlain($_SESSION['ups']['destination']->city);
  $address->zone = SafeMarkup::checkPlain($_SESSION['ups']['destination']->zone);
  $address->postal_code = SafeMarkup::checkPlain($_SESSION['ups']['destination']->postal_code);
  $address->country = SafeMarkup::checkPlain($_SESSION['ups']['destination']->country);
  $output .= (string) $address;
  $output .= '<br />' . SafeMarkup::checkPlain($_SESSION['ups']['destination']->email);
  $output .= '</div>';
  $output .= '<div class="shipment-data">';
  $method = uc_ups_uc_shipping_method();
  $output .= '<b>' . $method['ups']['quote']['accessorials'][$_SESSION['ups']['service']] . '</b><br />';
  $output .= '<i>' . SafeMarkup::checkPlain($_SESSION['ups']['rate']['type']) . '</i>: ' . theme('uc_price', [
    'price' => $_SESSION['ups']['rate']['amount'],
  ]) . ' (' . SafeMarkup::checkPlain($_SESSION['ups']['rate']['currency']) . ') -- ';
  $output .= '<i>' . t('Paid') . '</i>: ' . $_SESSION['ups']['paid'] . '<br />';
  $ship_date = $_SESSION['ups']['ship_date'];
  $output .= 'Ship date: ' . \Drupal::service('date.formatter')
    ->format(gmmktime(12, 0, 0, $ship_date['month'], $ship_date['day'], $ship_date['year']), 'uc_store');
  $exp_delivery = $_SESSION['ups']['expected_delivery'];
  $output .= '<br />Expected delivery: ' . \Drupal::service('date.formatter')
    ->format(gmmktime(12, 0, 0, $exp_delivery['month'], $exp_delivery['day'], $exp_delivery['year']), 'uc_store');
  $output .= "</div>\n<br style=\"clear: both;\" />";
  $output .= drupal_render_children($form);
  return $output;
}