|
|
@@ -180,14 +180,13 @@ class ProductSolver extends AbstractService implements SolverInterface |
|
|
|
$producer = GlobalParam::getCurrentProducer(); |
|
|
|
if ($producer->option_export_display_product_reference |
|
|
|
&& $product->reference |
|
|
|
&& strlen($product->reference) > 0) |
|
|
|
{ |
|
|
|
&& strlen($product->reference) > 0) { |
|
|
|
return $product->reference; |
|
|
|
} |
|
|
|
|
|
|
|
return $product->name; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function isProductActiveByDay(Product $product, string $day): bool |
|
|
|
{ |
|
|
|
return $product->active && $product->$day; |
|
|
@@ -195,7 +194,7 @@ class ProductSolver extends AbstractService implements SolverInterface |
|
|
|
|
|
|
|
public function getProductFieldNameQuantityMax(string $day): string |
|
|
|
{ |
|
|
|
return 'quantity_max_'.$day; |
|
|
|
return 'quantity_max_' . $day; |
|
|
|
} |
|
|
|
|
|
|
|
public function isProductQuantityMaxDefinedByDay(Product $product, string $day): bool |
|
|
@@ -207,22 +206,21 @@ class ProductSolver extends AbstractService implements SolverInterface |
|
|
|
public function getProductQuantityMaxByDay(Product $product, string $day): ?float |
|
|
|
{ |
|
|
|
$quantityMax = ($product->quantity_max && $product->quantity_max > 0) ? $product->quantity_max : null; |
|
|
|
if($this->isProductQuantityMaxDefinedByDay($product, $day)) { |
|
|
|
if ($this->isProductQuantityMaxDefinedByDay($product, $day)) { |
|
|
|
$fieldQuantityMax = $this->getProductFieldNameQuantityMax($day); |
|
|
|
$quantityMax = $product->$fieldQuantityMax; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $quantityMax; |
|
|
|
} |
|
|
|
|
|
|
|
public function isPublic(Product $product): bool |
|
|
|
{ |
|
|
|
if($product->available_on_points_sale) { |
|
|
|
if ($product->available_on_points_sale) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
else { |
|
|
|
foreach($product->productPointSale as $productPointSale) { |
|
|
|
if($productPointSale->pointSale && $this->pointSaleSolver->isPublic($productPointSale->pointSale)) { |
|
|
|
} else { |
|
|
|
foreach ($product->productPointSale as $productPointSale) { |
|
|
|
if ($productPointSale->pointSale && $this->pointSaleSolver->isPublic($productPointSale->pointSale)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@@ -230,4 +228,19 @@ class ProductSolver extends AbstractService implements SolverInterface |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public function filterProductsByPointSale(array $productArray, PointSale $pointSale = null): array |
|
|
|
{ |
|
|
|
$productArrayFilter = []; |
|
|
|
|
|
|
|
if($pointSale) { |
|
|
|
foreach ($productArray as $product) { |
|
|
|
if ($this->isAvailableOnPointSale($product, $pointSale)) { |
|
|
|
$productArrayFilter[] = $product; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $productArrayFilter; |
|
|
|
} |
|
|
|
} |