Function Reference: geodir_get_discount_amount
Summary
This function has not been documented yet.
Source Code
function geodir_get_discount_amount($coupon,$amount)
{
global $wpdb;
if($coupon!='' && $amount>0)
{
$couponinfo = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".COUPON_TABLE." WHERE coupon_code=%s",array($coupon)));
if($couponinfo)
{
if($couponinfo->discount_type=='per')
{
$discount_amt = ($amount*$couponinfo->discount_amount)/100;
}elseif($couponinfo->discount_type=='amt')
{
$discount_amt = $couponinfo->discount_amount;
}
return number_format($discount_amt, 2, '.', '');
}
}
return '0';
}