function _uc_coupon_format_discount in Ubercart Discount Coupons 7.2
Same name and namespace in other branches
- 7.3 uc_coupon.module \_uc_coupon_format_discount()
Format a coupon's value depending on the type, optionally including currency symbols.
2 calls to _uc_coupon_format_discount()
- theme_uc_coupon_discount in ./
uc_coupon.module - Theme for a coupon discount.
- uc_coupon_add_form in ./
uc_coupon.admin.inc - Coupon add/edit form.
File
- ./
uc_coupon.module, line 327
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);
}
}