You are here

function uc_order_condition_value_operator_comparison in Ubercart 7.3

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

Value comparison.

Parameters

float $source: The source value.

string $op: The comparison operator.

float $target: The target value.

Return value

bool Whether the comparison meets the specified conditions.

See also

uc_order_condition_value_operator_options

4 calls to uc_order_condition_value_operator_comparison()
uc_order_condition_count_products in uc_order/uc_order.rules.inc
Checks that the order has the selected number of products.
uc_order_condition_products_weight in uc_order/uc_order.rules.inc
Checks the weight of the order's products.
uc_order_condition_subtotal in uc_order/uc_order.rules.inc
Compare order subtotal.
uc_order_condition_total in uc_order/uc_order.rules.inc
Compare order total.

File

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

Code

function uc_order_condition_value_operator_comparison($source, $op, $target) {
  switch ($op) {
    case 'less':
      return $source < $target;
    case 'less_equal':
      return $source <= $target;
    case 'equal':
      return $source == $target;
    case 'greater_equal':
      return $source >= $target;
    case 'greater':
      return $source > $target;
  }
}