Переглянути джерело

Merge branch 'develop'

master
Fab 2 роки тому
джерело
коміт
bbe7f187fa
2 змінених файлів з 13 додано та 12 видалено
  1. +8
    -9
      Builder/Order/OrderShopBuilder.php
  2. +5
    -3
      Controller/Order/CartController.php

+ 8
- 9
Builder/Order/OrderShopBuilder.php Переглянути файл

@@ -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(

+ 5
- 3
Controller/Order/CartController.php Переглянути файл

@@ -78,13 +78,15 @@ class CartController extends AbstractController
public function addOrderProduct(OrderShopInterface $orderShop, OrderProductInterface $orderProduct): void
{
$this->quantityOrder = $orderProduct->getQuantityOrder();
$addOrderProduct = $this->getOrderShopContainer()->getBuilder()->addOrderProduct(
$orderProductArray = $this->getOrderShopContainer()->getBuilder()->addOrderProduct(
$orderShop,
$orderProduct
);

if (isset($addOrderProduct) && $addOrderProduct && $orderProduct->getQuantityOrder() > 0) {
$this->orderProducts[] = $orderProduct;
if (is_array($orderProductArray)) {
foreach($orderProductArray as $orderProduct) {
$this->orderProducts[] = $orderProduct;
}
}
}


Завантаження…
Відмінити
Зберегти