|
|
@@ -229,18 +229,18 @@ class OrderShopBuilder |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
OrderProductInterface $orderProductAdd, |
|
|
|
bool $persist = true |
|
|
|
): bool { |
|
|
|
$return = false; |
|
|
|
): ?array { |
|
|
|
$orderProductAddedArray = []; |
|
|
|
|
|
|
|
$orderProductAdd->setOrderShop($orderShop); |
|
|
|
|
|
|
|
if ($this->orderShopSolver->isOrderProductAvailableAddCart($orderProductAdd, $orderShop)) { |
|
|
|
if ($orderProductAdd->getQuantityOrder() > 0) { |
|
|
|
$orderProductAddedArray[] = $orderProductAdd; |
|
|
|
$updated = false; |
|
|
|
|
|
|
|
$this->orderProductBuilder->init($orderProductAdd); |
|
|
|
|
|
|
|
//TODO vérifier ma modif ici |
|
|
|
if(is_null($orderProductAdd->getOrderProductReductionCatalog())) { |
|
|
|
// on hydrate $productFamily avec réduction |
|
|
|
$productFamily = $this->productFamilyStore->setSection($orderShop->getSection())->getOneBySlug( |
|
|
@@ -250,6 +250,7 @@ class OrderShopBuilder |
|
|
|
$this->orderProductBuilder->initReductionCatalog($orderShop->getSection(), $orderProductAdd, $productFamily); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($orderShop->getOrderProducts() as $orderProduct) { |
|
|
|
if ($this->orderProductSolver->compare($orderProduct, $orderProductAdd)) { |
|
|
|
|
|
|
@@ -262,8 +263,6 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
|
|
|
|
$updated = true; |
|
|
|
$return = true; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@@ -279,8 +278,6 @@ class OrderShopBuilder |
|
|
|
$this->entityManager->persist($orderProductAdd); |
|
|
|
$this->entityManager->update($orderShop); |
|
|
|
} |
|
|
|
|
|
|
|
$return = true; |
|
|
|
} |
|
|
|
|
|
|
|
if ($persist) { |
|
|
@@ -310,11 +307,13 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
} |
|
|
|
$this->utils->addFlash('error', $textError);*/ |
|
|
|
} |
|
|
|
|
|
|
|
$return = false; |
|
|
|
if(count($orderProductAddedArray) == 0) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
return $return; |
|
|
|
return $orderProductAddedArray; |
|
|
|
} |
|
|
|
|
|
|
|
public function merge( |