Commit 52ae894e authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Fix evaluate_for_skus/evaluate_for_products

parent 2eefc774
......@@ -673,8 +673,8 @@ class ShippingRule {
$filterkeys = array(
"evaluate_for_categories" => 'categories',
"evaluate_for_products" => 'products',
"evaluate_for_skus" => 'products',
"evaluate_for_products" => 'skus',
"evaluate_for_skus" => 'skus',
"evaluate_for_vendors" => 'vendors',
"evaluate_for_manufacturers" => 'manufacturers'
);
......@@ -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
// 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:
$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);
if (is_null($expr)) {
......@@ -808,7 +808,11 @@ class ShippingRule {
$op = array_shift($expr); // ignore the "FUNCTION"
$func = array_shift($expr); // The scoping function name
$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);
} elseif (is_array($expr)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment