|
|
|
|
|
|
|
|
$products = $this->getProductsOnline($productFamily)->getValues(); |
|
|
$products = $this->getProductsOnline($productFamily)->getValues(); |
|
|
if (count($products) > 0) { |
|
|
if (count($products) > 0) { |
|
|
usort($products, $comparisonFunction); |
|
|
usort($products, $comparisonFunction); |
|
|
|
|
|
|
|
|
return $products[0]; |
|
|
return $products[0]; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
return $this->getOriginProduct($returnSelfIfNotActiveProducts); |
|
|
|
|
|
|
|
|
return $this->getOriginProduct($productFamily); |
|
|
} |
|
|
} |
|
|
if ($returnSelfIfNotActiveProducts) { |
|
|
if ($returnSelfIfNotActiveProducts) { |
|
|
return $productFamily; |
|
|
return $productFamily; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getOriginProduct(ProductFamilyInterface $productFamily): ProductInterface |
|
|
|
|
|
|
|
|
public function getOriginProduct(ProductFamilyInterface $productFamily): ?ProductInterface |
|
|
{ |
|
|
{ |
|
|
$products = $productFamily->getProducts(); |
|
|
$products = $productFamily->getProducts(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $product; |
|
|
return $product; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|