function payment_method_adjustment_description in Ubercart Payment Method Adjustments 6
Same name and namespace in other branches
- 7 uc_pma.module \payment_method_adjustment_description()
1 call to payment_method_adjustment_description()
- uc_pma_form_alter in ./
uc_pma.module - Implementation of hook_form_alter().
File
- ./
uc_pma.module, line 144 - This module hooks into a few different parts of Ubercart to allow store administrators to associate a fee or discount with payment methods.
Code
function payment_method_adjustment_description($method_id) {
$name = _payment_method_data($method_id, 'name');
$adjustment = variable_get('uc_payment_method_' . $method_id . '_adjustment', '');
if (empty($name) || empty($adjustment)) {
return;
}
$adjustment = ereg_replace('[^-0-9' . variable_get('uc_currency_dec', '.') . '%]+', '', $adjustment);
if (!strstr($adjustment, '%')) {
$adjustment = uc_currency_format(str_replace(variable_get('uc_currency_dec', '.'), ".", $adjustment));
}
if (strstr($adjustment, '-')) {
$description = t('Receive a !adjustment discount when paying by !method.', array(
'!adjustment' => str_replace('-', '', $adjustment),
'!method' => $name,
));
}
else {
$description = t('There is a !adjustment fee when paying by !method.', array(
'!adjustment' => $adjustment,
'!method' => $name,
));
}
return $description;
}