You are here

function uc_usps_shipping_method in Ubercart 6.2

Same name and namespace in other branches
  1. 5 shipping/uc_usps/uc_usps.module \uc_usps_shipping_method()

Implements hook_shipping_method().

File

shipping/uc_usps/uc_usps.module, line 260
Shipping quote method module that receives quotes from the United States Postal Service via XML web service.

Code

function uc_usps_shipping_method() {
  $enabled = variable_get('uc_quote_enabled', array());
  $weight = variable_get('uc_quote_method_weight', array(
    'usps_env' => 0,
    'usps' => 0,
    'usps_intl_env' => 1,
    'usps_intl' => 1,
  ));
  $methods = array(
    'usps_env' => array(
      'id' => 'usps_env',
      'module' => 'uc_usps',
      'title' => t('U.S. Postal Service (Envelope)'),
      'quote' => array(
        'type' => 'envelope',
        'callback' => 'uc_usps_quote',
        'accessorials' => _uc_usps_env_services(),
      ),
      'enabled' => $enabled['usps_env'],
      'weight' => $weight['usps_env'],
    ),
    'usps' => array(
      'id' => 'usps',
      'module' => 'uc_usps',
      'title' => t('U.S. Postal Service (Parcel)'),
      'quote' => array(
        'type' => 'small_package',
        'callback' => 'uc_usps_quote',
        'accessorials' => _uc_usps_services(),
      ),
      'enabled' => $enabled['usps'],
      'weight' => $weight['usps'],
    ),
    'usps_intl_env' => array(
      'id' => 'usps_intl_env',
      'module' => 'uc_usps',
      'title' => t('U.S. Postal Service (Intl., Envelope)'),
      'quote' => array(
        'type' => 'envelope',
        'callback' => 'uc_usps_quote',
        'accessorials' => _uc_usps_intl_env_services(),
      ),
      'enabled' => $enabled['usps_intl_env'],
      'weight' => $weight['usps_intl_env'],
    ),
    'usps_intl' => array(
      'id' => 'usps_intl',
      'module' => 'uc_usps',
      'title' => t('U.S. Postal Service (Intl., Parcel)'),
      'quote' => array(
        'type' => 'small_package',
        'callback' => 'uc_usps_quote',
        'accessorials' => _uc_usps_intl_services(),
      ),
      'enabled' => $enabled['usps_intl'],
      'weight' => $weight['usps_intl'],
    ),
  );
  return $methods;
}