You are here

function uc_ups_markup in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_ups/uc_ups.module \uc_ups_markup()

Modify the rate received from UPS before displaying to the customer.

1 call to uc_ups_markup()
uc_ups_quote in shipping/uc_ups/uc_ups.module
Callback for retrieving a UPS shipping quote.
3 string references to 'uc_ups_markup'
uc_ups_admin_settings in shipping/uc_ups/uc_ups.module
UPS Online Tool settings.
uc_ups_uninstall in shipping/uc_ups/uc_ups.install
uc_ups_update_5 in shipping/uc_ups/uc_ups.install

File

shipping/uc_ups/uc_ups.module, line 1475
Shipping quote module that interfaces with www.ups.com to get rates for small package shipments.

Code

function uc_ups_markup($rate) {
  $markup = variable_get('uc_ups_markup', '0');
  $type = variable_get('uc_ups_markup_type', 'percentage');
  if (is_numeric(trim($markup))) {
    switch ($type) {
      case 'percentage':
        return $rate + $rate * floatval(trim($markup)) / 100;
      case 'multiplier':
        return $rate * floatval(trim($markup));
      case 'currency':
        return $rate + floatval(trim($markup));
    }
  }
  else {
    return $rate;
  }
}