|
|
@@ -43,7 +43,7 @@ class ProductFamilyResolver |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function getCheapestProduct(ProductFamilyInterface $productFamily, OrderShopInterface $orderShop) |
|
|
|
public function getCheapestProduct(ProductFamilyInterface $productFamily, OrderShopInterface $orderShop = null) |
|
|
|
{ |
|
|
|
$priceSolver = $this->priceSolver; |
|
|
|
|
|
|
@@ -59,7 +59,7 @@ class ProductFamilyResolver |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function getCheapestProductByRefUnit(ProductFamilyInterface $productFamily, OrderShopInterface $orderShop) |
|
|
|
public function getCheapestProductByRefUnit(ProductFamilyInterface $productFamily, OrderShopInterface $orderShop = null) |
|
|
|
{ |
|
|
|
$priceSolver = $this->priceSolver; |
|
|
|
|
|
|
@@ -75,7 +75,7 @@ class ProductFamilyResolver |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function getMostExpensiveProductByRefUnit(ProductFamilyInterface $productFamily, OrderShopInterface $orderShop) |
|
|
|
public function getMostExpensiveProductByRefUnit(ProductFamilyInterface $productFamily, OrderShopInterface $orderShop = null) |
|
|
|
{ |
|
|
|
$priceSolver = $this->priceSolver; |
|
|
|
|
|
|
@@ -95,7 +95,7 @@ class ProductFamilyResolver |
|
|
|
ProductFamilyInterface $productFamily, |
|
|
|
$comparisonFunction, |
|
|
|
$returnSelfIfNotActiveProducts, |
|
|
|
OrderShopInterface $orderShop |
|
|
|
OrderShopInterface $orderShop = null |
|
|
|
) |
|
|
|
{ |
|
|
|
if ($productFamily->getActiveProducts()) { |
|
|
@@ -104,9 +104,11 @@ class ProductFamilyResolver |
|
|
|
if (count($products) > 0) { |
|
|
|
usort($products, $comparisonFunction); |
|
|
|
|
|
|
|
foreach ($products as $product) { |
|
|
|
if ($this->orderShopSolver->isProductAvailable($orderShop->getSection(), $orderShop, $product, 1, true)) { |
|
|
|
return $product; |
|
|
|
if($orderShop) { |
|
|
|
foreach ($products as $product) { |
|
|
|
if ($this->orderShopSolver->isProductAvailable($orderShop->getSection(), $orderShop, $product, 1, true)) { |
|
|
|
return $product; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|