|
|
@@ -40,10 +40,14 @@ class ProductFamilyUtils |
|
|
|
|
|
|
|
private function getCheapestOrMostExpensiveProduct($productFamily, $comparisonFunction, $returnSelfIfNotActiveProducts) |
|
|
|
{ |
|
|
|
$products = $productFamily->getProductsOnline()->getValues() ; |
|
|
|
if (count($products) > 0) { |
|
|
|
usort($products, $comparisonFunction); |
|
|
|
return $products[0]; |
|
|
|
if($productFamily->getActiveProducts()) { |
|
|
|
$products = $productFamily->getProductsOnline()->getValues(); |
|
|
|
if (count($products) > 0) { |
|
|
|
usort($products, $comparisonFunction); |
|
|
|
return $products[0]; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return $productFamily->getOriginProduct(); |
|
|
|
} |
|
|
|
if ($returnSelfIfNotActiveProducts) { |
|
|
|
return $productFamily; |