function uc_usps_update_6001 in Ubercart 6.2
Set default weight for new shipping type.
File
- shipping/
uc_usps/ uc_usps.install, line 193 - Install hooks for uc_usps.module.
Code
function uc_usps_update_6001() {
$shipping_type_weights = variable_get('uc_quote_type_weight', NULL);
if (isset($shipping_type_weights)) {
$shipping_type_weights['envelope'] = -1;
variable_set('uc_quote_type_weight', $shipping_type_weights);
}
$services = variable_get('uc_usps_services', NULL);
if (isset($services)) {
$env_services = array(
'zero' => t('U.S.P.S. First-Class Mail'),
'zeroFlat' => t('U.S.P.S. First-Class Flat'),
12 => t('U.S.P.S. First-Class Postcard Stamped'),
1 => t('U.S.P.S. Priority Mail'),
16 => t('U.S.P.S. Priority Mail Flat-Rate Envelope'),
2 => t('U.S.P.S. Express Mail PO to PO'),
3 => t('U.S.P.S. Express Mail PO to Addressee'),
13 => t('U.S.P.S. Express Mail Flat-Rate Envelope'),
);
$new_services = array();
foreach ($env_services as $id => $value) {
$new_services[$id] = $services[$id];
unset($services[$id]);
}
variable_set('uc_usps_env_services', $new_services);
variable_set('uc_usps_services', $services);
}
$services = variable_get('uc_usps_intl_services', NULL);
if (isset($services)) {
$intl_env_services = array(
13 => t('First Class Mail International Letter'),
14 => t('First Class Mail International Flat'),
2 => t('Priority Mail International'),
8 => t('Priority Mail International Flat Rate Envelope'),
4 => t('Global Express Guaranteed'),
1 => t('Express Mail International (EMS)'),
10 => t('Express Mail International (EMS) Flat Rate Envelope'),
);
$new_services = array();
foreach ($intl_env_services as $id => $value) {
$new_services[$id] = $services[$id];
unset($services[$id]);
}
variable_set('uc_usps_intl_env_services', $new_services);
variable_set('uc_usps_intl_services', $services);
}
return array();
}