Loading commerce_discount_extra.module +10 −9 Original line number Diff line number Diff line Loading @@ -273,24 +273,21 @@ function commerce_discount_extra_user_has_role_build(EntityDrupalWrapper $wrappe * Returns TRUE if condition is valid, FALSE otherwise. */ function commerce_discount_extra_line_item_price_comp_build(EntityDrupalWrapper $line_item_wrapper, $price, $operator, $method) { // Ensure that it is a product line item and that it is the same currency as // the price argument. $line_item_total = $line_item_wrapper->commerce_total->value(); if (!in_array($line_item_wrapper->getBundle(), commerce_product_line_item_types()) || $line_item_total['currency_code'] != $price['currency_code']) { // Ensure that it is a product line item. if (!in_array($line_item_wrapper->getBundle(), commerce_product_line_item_types())) { return FALSE; } // Calculate line item amount. // Select the appropriate line item price based on the comparison method. switch ($method) { case 'base': // Get product base price. $line_item_amount = $line_item_wrapper->commerce_product->commerce_price->amount->value(); $line_item_price = $line_item_wrapper->commerce_product->commerce_price->value(); break; case 'calculated': // Get line item total. $line_item_amount = $line_item_wrapper->commerce_total->amount->value(); $line_item_price = $line_item_wrapper->commerce_total->value(); break; // Invalid method. Loading @@ -298,8 +295,12 @@ function commerce_discount_extra_line_item_price_comp_build(EntityDrupalWrapper return FALSE; } // Convert the comparison amount to the line item's currency to make an even // comparison. $comparison_price_amount = commerce_currency_convert($price['amount'], $price['currency_code'], $line_item_price['currency_code']); // Evaluate expression. return _commerce_discount_extra_expression_eval($line_item_amount, $price['amount'], $operator); return _commerce_discount_extra_expression_eval($line_item_price['amount'], $comparison_price_amount, $operator); } /** Loading Loading
commerce_discount_extra.module +10 −9 Original line number Diff line number Diff line Loading @@ -273,24 +273,21 @@ function commerce_discount_extra_user_has_role_build(EntityDrupalWrapper $wrappe * Returns TRUE if condition is valid, FALSE otherwise. */ function commerce_discount_extra_line_item_price_comp_build(EntityDrupalWrapper $line_item_wrapper, $price, $operator, $method) { // Ensure that it is a product line item and that it is the same currency as // the price argument. $line_item_total = $line_item_wrapper->commerce_total->value(); if (!in_array($line_item_wrapper->getBundle(), commerce_product_line_item_types()) || $line_item_total['currency_code'] != $price['currency_code']) { // Ensure that it is a product line item. if (!in_array($line_item_wrapper->getBundle(), commerce_product_line_item_types())) { return FALSE; } // Calculate line item amount. // Select the appropriate line item price based on the comparison method. switch ($method) { case 'base': // Get product base price. $line_item_amount = $line_item_wrapper->commerce_product->commerce_price->amount->value(); $line_item_price = $line_item_wrapper->commerce_product->commerce_price->value(); break; case 'calculated': // Get line item total. $line_item_amount = $line_item_wrapper->commerce_total->amount->value(); $line_item_price = $line_item_wrapper->commerce_total->value(); break; // Invalid method. Loading @@ -298,8 +295,12 @@ function commerce_discount_extra_line_item_price_comp_build(EntityDrupalWrapper return FALSE; } // Convert the comparison amount to the line item's currency to make an even // comparison. $comparison_price_amount = commerce_currency_convert($price['amount'], $price['currency_code'], $line_item_price['currency_code']); // Evaluate expression. return _commerce_discount_extra_expression_eval($line_item_amount, $price['amount'], $operator); return _commerce_discount_extra_expression_eval($line_item_price['amount'], $comparison_price_amount, $operator); } /** Loading