function uc_usps_markup in Ubercart 5
Same name and namespace in other branches
- 6.2 shipping/uc_usps/uc_usps.module \uc_usps_markup()
Modify the rate received from USPS before displaying to the customer.
2 calls to uc_usps_markup()
- uc_usps_intl_quote in shipping/
uc_usps/ uc_usps.module - Callback for retrieving USPS shipping quote to other countries.
- uc_usps_quote in shipping/
uc_usps/ uc_usps.module - Callback for retrieving USPS shipping quote.
3 string references to 'uc_usps_markup'
- uc_usps_admin_settings in shipping/
uc_usps/ uc_usps.module - Configure USPS settings.
- uc_usps_uninstall in shipping/
uc_usps/ uc_usps.install - uc_usps_update_3 in shipping/
uc_usps/ uc_usps.install
File
- shipping/
uc_usps/ uc_usps.module, line 523 - 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;
}
}