diff --git a/rules_shipping_base.php b/rules_shipping_base.php index 1bc990e237ec96fed8d18f371c713b742cf992e5..2c9ad6c3d8a7ccd8dc06a93329603a4e55932a0f 100644 --- a/rules_shipping_base.php +++ b/rules_shipping_base.php @@ -32,6 +32,13 @@ if (class_exists ('plgVmShipmentRules_Shipping_Base')) { // Keep track of warning messages, so we don't print them twice: $printed_warnings = array(); +function is_equal($a, $b) { + if (is_array($a) && is_array($b)) { + return !array_diff($a, $b) && !array_diff($b, $a); + } else { + return $a == $b; + } +} /** Shipping costs according to general rules. * Supported Variables: Weight, ZIP, Amount, Products (1 for each product, even if multiple ordered), Articles * Assignable variables: Shipping, Name @@ -808,7 +815,7 @@ class ShippingRule { case '<': $res = ($terms[0] < $terms[2]); break; case '<=': case '=<': $res = ($terms[0] <= $terms[2]); break; - case '==': $res = ($terms[0] == $terms[2]); break; + case '==': $res = is_equal($terms[0], $terms[2]); break; case '!=': case '<>': $res = ($terms[0] != $terms[2]); break; case '>=': @@ -824,6 +831,7 @@ class ShippingRule { } if ($res==false) return false; + // Remove the first operand and the operator from the comparison: array_shift($terms); array_shift($terms); }