Commit a35f4a53 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Forward port of V5.7: Add variables MinQuantity and MaxQuantity

parent 41fd5a2e
......@@ -210,7 +210,12 @@ class RulesShippingFramework {
*/
/** Functions to calculate all the different variables for the given cart and given (sub)set of products in the cart */
protected function getOrderCounts ($cart, $products, $method) {
return array('articles' => 0, 'products' => count($products));
return array(
'articles' => 0,
'products' => count($products),
'minquantity' => 9999999999,
'maxquantity' => 0,
);
}
protected function getOrderDimensions ($cart, $products, $method) {
......
......@@ -98,13 +98,21 @@ class RulesShippingFrameworkJoomla extends RulesShippingFramework {
* - getOrderDimensions
*/
/** Functions to calculate all the different variables for the given cart and given (sub)set of products in the cart */
protected function getOrderCounts ($cart, $products, $method) {
$counts = array('products' => count($products));
$articles = 0;
protected function getOrderCounts (VirtueMartCart $cart, $products, $method) {
$counts = array(
'articles' => 0,
'products' => count($products),
'minquantity' => 9999999999,
'maxquantity' => 0,
);
foreach ($products as $product) {
$articles += $product->quantity;
$counts['articles'] += $product->quantity;
$counts['maxquantity'] = max ($counts['maxquantity'], $product->quantity);
$counts['minquantity'] = min ($counts['minquantity'], $product->quantity);
}
$counts['articles'] = $articles;
$counts['quantity'] = $counts['articles'];
return $counts;
}
......
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