You are here

function uc_fedex_weight_markup in FedEx Shipping 5

Same name and namespace in other branches
  1. 6.2 uc_fedex.module \uc_fedex_weight_markup()
  2. 6 uc_fedex.module \uc_fedex_weight_markup()
  3. 7.2 uc_fedex.module \uc_fedex_weight_markup()
  4. 7 uc_fedex.module \uc_fedex_weight_markup()

Modify the weight of shipment before sending to FedEx for a quote.

Parameters

weight: Shipping weight without any weight markup

Return value

Shipping weight after markup

1 call to uc_fedex_weight_markup()
_uc_fedex_package_products in ./uc_fedex.module
Puts everything in one package, for now.
2 string references to 'uc_fedex_weight_markup'
uc_fedex_admin_settings in ./uc_fedex.module
Default FedEx Web Services API settings.
uc_fedex_uninstall in ./uc_fedex.install
Implementation of hook_uninstall()

File

./uc_fedex.module, line 845
FedEx Web Services Rate / Available Services Quote

Code

function uc_fedex_weight_markup($weight) {
  $markup = trim(variable_get('uc_fedex_weight_markup', '0'));
  $type = variable_get('uc_fedex_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;
  }
}