You are here

function uc_usps_weight_markup in Ubercart 7.3

Modifies the weight of shipment before sending to USPS for a quote.

Parameters

$weight: Shipping weight without any weight markup.

Return value

Shipping weight after markup.

4 string references to 'uc_usps_weight_markup'
uc_usps_admin_settings in shipping/uc_usps/uc_usps.admin.inc
Configures USPS settings.
uc_usps_admin_settings_submit in shipping/uc_usps/uc_usps.admin.inc
Submit handler for uc_usps_admin_settings form.
uc_usps_admin_settings_validate in shipping/uc_usps/uc_usps.admin.inc
Validation handler for uc_usps_admin_settings form.
uc_usps_uninstall in shipping/uc_usps/uc_usps.install
Implements hook_uninstall().

File

shipping/uc_usps/uc_usps.module, line 597
United States Postal Service (USPS) shipping quote module.

Code

function uc_usps_weight_markup($weight) {
  $markup = trim(variable_get('uc_usps_weight_markup', '0'));
  $type = variable_get('uc_usps_weight_markup_type', 'percentage');
  if (is_numeric($markup)) {
    switch ($type) {
      case 'percentage':
        return $weight + $weight * floatval($markup) / 100;
      case 'multiplier':
        return $weight * floatval($markup);
      case 'mass':
        return $weight + floatval($markup);
    }
  }
  else {
    return $weight;
  }
}