function uc_usps_markup in Ubercart 6.2
Same name and namespace in other branches
- 5 shipping/uc_usps/uc_usps.module \uc_usps_markup()
Modifies the rate received from USPS before displaying to the customer.
Parameters
$rate: Shipping rate without any rate markup.
Return value
Shipping rate after markup.
1 call to uc_usps_markup()
- uc_usps_quote in shipping/
uc_usps/ uc_usps.module - Callback for retrieving USPS shipping quote.
4 string references to 'uc_usps_markup'
- uc_usps_admin_settings in shipping/
uc_usps/ uc_usps.admin.inc - Configure USPS settings.
- 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().
- uc_usps_update_3 in shipping/
uc_usps/ uc_usps.install
File
- shipping/
uc_usps/ uc_usps.module, line 649 - Shipping quote method module that receives quotes from the United States Postal Service via XML web service.
Code
function uc_usps_markup($rate) {
$markup = variable_get('uc_usps_markup', '0');
$type = variable_get('uc_usps_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;
}
}