You are here

function template_preprocess_uc_packing_slip in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 shipping/uc_fulfillment/uc_fulfillment.module \template_preprocess_uc_packing_slip()
  2. 6.2 shipping/uc_shipping/uc_shipping.module \template_preprocess_uc_packing_slip()

Preprocess function to make tokens available in the packing slip template.

See also

uc-packing-slip.tpl.php

File

shipping/uc_shipping/uc_shipping.module, line 246
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 template_preprocess_uc_packing_slip(&$variables) {
  $tokens = token_generate('site', drupal_map_assoc(array(
    'logo',
  )));
  $variables['site_logo'] = isset($tokens['logo']) ? $tokens['logo'] : '';
  $tokens = token_generate('store', drupal_map_assoc(array(
    'name',
    'address',
    'phone',
  )));
  $variables['store_name'] = $tokens['name'];
  $variables['store_address'] = $tokens['address'];
  $variables['store_phone'] = $tokens['phone'];
  $order = $variables['order'];
  $variables['order_link'] = l($order->order_id, url('user/' . $order->uid . '/orders/' . $order->order_id, array(
    'absolute' => TRUE,
  )));
  $variables['order_email'] = check_plain($order->primary_email);
  $variables['billing_address'] = uc_order_address($order, 'billing');
  $variables['billing_phone'] = check_plain($order->billing_phone);
  $variables['shipping_address'] = uc_order_address($order, 'delivery');
  $variables['shipping_phone'] = check_plain($order->delivery_phone);
  if (module_exists('uc_payment')) {
    $payment_method = _uc_payment_method_data($order->payment_method, 'review');
    if (empty($payment_method)) {
      $payment_method = _uc_payment_method_data($order->payment_method, 'name');
    }
    $variables['payment_method'] = $payment_method;
  }
  else {
    $variables['payment_method'] = '';
  }
  $shipment = $variables['shipment'];
  $variables['carrier'] = check_plain($shipment->carrier);
  $variables['tracking_number'] = check_plain($shipment->tracking_number);
  $variables['packages'] = $shipment->packages;
}