You are here

function uc_order_condition_subtotal in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_order/uc_order.rules.inc \uc_order_condition_subtotal()

Compare order subtotal.

Parameters

object $order: The order to check.

string $op: The comparison operator.

float $value: The target value.

Return value

bool Whether the order subtotal meets the specified condition.

See also

uc_order_condition_value_operator_options

1 string reference to 'uc_order_condition_subtotal'
uc_order_rules_condition_info in uc_order/uc_order.rules.inc
Implements hook_rules_condition_info().

File

uc_order/uc_order.rules.inc, line 917
Hooks and functions for uc_order Rules integration.

Code

function uc_order_condition_subtotal($order, $op, $value) {
  if (is_array($order->line_items)) {
    foreach ($order->line_items as $line_item) {
      if ($line_item['type'] == 'subtotal') {
        $subtotal = $line_item['amount'];
        return uc_order_condition_value_operator_comparison($subtotal, $op, $value);
      }
    }
  }
  return FALSE;
}