Skip to content
Snippets Groups Projects
Commit 52ae894e authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Fix evaluate_for_skus/evaluate_for_products

parent 2eefc774
No related branches found
No related tags found
No related merge requests found
...@@ -673,8 +673,8 @@ class ShippingRule { ...@@ -673,8 +673,8 @@ class ShippingRule {
$filterkeys = array( $filterkeys = array(
"evaluate_for_categories" => 'categories', "evaluate_for_categories" => 'categories',
"evaluate_for_products" => 'products', "evaluate_for_products" => 'skus',
"evaluate_for_skus" => 'products', "evaluate_for_skus" => 'skus',
"evaluate_for_vendors" => 'vendors', "evaluate_for_vendors" => 'vendors',
"evaluate_for_manufacturers" => 'manufacturers' "evaluate_for_manufacturers" => 'manufacturers'
); );
...@@ -790,7 +790,7 @@ class ShippingRule { ...@@ -790,7 +790,7 @@ class ShippingRule {
// The scoping functions need to be handled differently, because they first need to adjust the cart variables to the filtered product list // The scoping functions need to be handled differently, because they first need to adjust the cart variables to the filtered product list
// before evaluating its first argument. So even though parsing the rules handles scoping functions like any other function, their // before evaluating its first argument. So even though parsing the rules handles scoping functions like any other function, their
// evaluation is fundamentally different and is special-cased here: // evaluation is fundamentally different and is special-cased here:
$scoping_functions = array("evaluate_for_categories", "evaluate_for_products", "evaluate_for_vendors", "evaluate_for_manufacturers"); $scoping_functions = array("evaluate_for_categories", "evaluate_for_products", "evaluate_for_skus", "evaluate_for_vendors", "evaluate_for_manufacturers");
$is_scoping = is_array($expr) && ($expr[0]=="FUNCTION") && (count($expr)>1) && in_array($expr[1], $scoping_functions); $is_scoping = is_array($expr) && ($expr[0]=="FUNCTION") && (count($expr)>1) && in_array($expr[1], $scoping_functions);
if (is_null($expr)) { if (is_null($expr)) {
...@@ -808,7 +808,11 @@ class ShippingRule { ...@@ -808,7 +808,11 @@ class ShippingRule {
$op = array_shift($expr); // ignore the "FUNCTION" $op = array_shift($expr); // ignore the "FUNCTION"
$func = array_shift($expr); // The scoping function name $func = array_shift($expr); // The scoping function name
$expression = array_shift($expr); // The expression to be evaluated $expression = array_shift($expr); // The expression to be evaluated
$conditions = $expr; // the remaining $expr list now contains the conditions // the remaining $expr list now contains the conditions. Evaluate them one by one:
$conditions = array();
foreach ($expr as $e) {
$conditions[] = $this->evaluateTerm($e, $vals, $products, $cartvals_callback);
}
return $this->evaluateScoping ($expression, $func, $conditions, $vals, $products, $cartvals_callback); return $this->evaluateScoping ($expression, $func, $conditions, $vals, $products, $cartvals_callback);
} elseif (is_array($expr)) { } elseif (is_array($expr)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment