Browse Source

Correctif

packProduct
Guillaume 3 years ago
parent
commit
56cd009e7c
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      Solver/Product/ProductFamilySolver.php

+ 4
- 3
Solver/Product/ProductFamilySolver.php View File

$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;
} }





Loading…
Cancel
Save