function uc_coupon_format_discount in Ubercart Discount Coupons 6
Format a coupon depending on the type, optionally including currency symbols.
6 calls to uc_coupon_format_discount()
- template_preprocess_uc_coupon_certificate in ./
uc_coupon.module - Preprocess template for a printed coupon certificate.
- uc_coupon_add_form in ./
uc_coupon.admin.inc - Coupon add/edit form.
- uc_coupon_display in ./
uc_coupon.admin.inc - Display a brief overview of system coupons
- uc_coupon_handler_field_value::render in views/
uc_coupon_handler_field_value.inc - uc_coupon_token_values in ./
uc_coupon.module - Implementation of hook_token_values().
File
- ./
uc_coupon.module, line 364 - Provides discount coupons for Ubercart.
Code
function uc_coupon_format_discount($coupon, $currency = TRUE) {
switch ($coupon->type) {
case 'price':
return $currency ? uc_currency_format($coupon->value) : $coupon->value;
case 'percentage':
return (double) $coupon->value . '%';
case 'set_price':
return '=' . ($currency ? uc_currency_format($coupon->value) : $coupon->value);
}
}