function uc_discounts_condition_total in Ubercart Discounts (Alternative) 6.2
Same name and namespace in other branches
- 7.2 uc_discounts/uc_discounts.ca.inc \uc_discounts_condition_total()
Check the current order balance minus any discounts.
See also
uc_discounts_condition_total_form()
1 string reference to 'uc_discounts_condition_total'
- uc_discounts_ca_condition in uc_discounts/
uc_discounts.ca.inc - Implementation of hook_ca_condition().
File
- uc_discounts/
uc_discounts.ca.inc, line 75
Code
function uc_discounts_condition_total($order, $settings) {
$order->uc_discounts_codes = $_SESSION['uc_discounts_codes'];
$discounts = get_discounts_for_order($order);
$total_discount = 0;
foreach ($discounts as $discount) {
$total_discount += $discount->amount;
}
$total = uc_order_get_total($order, TRUE) - $total_discount;
switch ($settings['order_total_comparison']) {
case 'less':
return $total < $settings['order_total_value'];
case 'less_equal':
return $total <= $settings['order_total_value'];
case 'equal':
return $total == $settings['order_total_value'];
case 'greater_equal':
return $total >= $settings['order_total_value'];
case 'greater':
return $total > $settings['order_total_value'];
}
}