You are here

function commerce_ups_commerce_shipping_service_info in Commerce UPS 7.2

Same name and namespace in other branches
  1. 7 commerce_ups.module \commerce_ups_commerce_shipping_service_info()

Implements hook_commerce_shipping_service_info().

File

./commerce_ups.module, line 42
Handles main functionality for Commerce UPS module.

Code

function commerce_ups_commerce_shipping_service_info() {
  $shipping_services = array();
  $available_services = _commerce_ups_service_list();
  $selected_services = variable_get('commerce_ups_services', array());
  foreach ($selected_services as $id => $val) {

    // If you find a selected one...
    if ($val != 0) {
      $service = $available_services[$id];
      $shipping_services[$service['slug']] = array(
        'title' => t($service['title']),
        'description' => t($service['description']),
        'display_title' => t($service['title']),
        'shipping_method' => 'ups',
        'price_component' => 'shipping',
        'callbacks' => array(
          'rate' => 'commerce_ups_service_rate_order',
        ),
      );
    }
  }
  return $shipping_services;
}