Browse Source

Correctif reductionCatalog #14

develop
Fabien Normand 2 years ago
parent
commit
76e38355c0
2 changed files with 10 additions and 5 deletions
  1. +1
    -4
      Builder/Order/OrderProductBuilder.php
  2. +9
    -1
      Builder/Order/OrderShopBuilder.php

+ 1
- 4
Builder/Order/OrderProductBuilder.php View File

return $orderProduct; return $orderProduct;
} }


public function initReductionCatalog(SectionInterface $section, OrderProductInterface $orderProduct, ProductFamilyInterface $productFamily = null): OrderProductInterface
public function initReductionCatalog(SectionInterface $section, OrderProductInterface $orderProduct, ProductFamilyInterface $productFamily): OrderProductInterface
{ {
if(!$orderProduct->getOrderProductReductionCatalog()) { if(!$orderProduct->getOrderProductReductionCatalog()) {
if (is_null($productFamily)) {
$productFamily = $orderProduct->getProduct()->getProductFamily();
}


$reductionCatalog = $productFamily->getReductionCatalog(); $reductionCatalog = $productFamily->getReductionCatalog();
if ($reductionCatalog && $reductionCatalog->getStatus()) { if ($reductionCatalog && $reductionCatalog->getStatus()) {

+ 9
- 1
Builder/Order/OrderShopBuilder.php View File

$updated = false; $updated = false;


$this->orderProductBuilder->init($orderProductAdd); $this->orderProductBuilder->init($orderProductAdd);
$this->orderProductBuilder->initReductionCatalog($orderShop->getSection(), $orderProductAdd);


//TODO vérifier ma modif ici
if(is_null($orderProductAdd->getOrderProductReductionCatalog())) {
$productFamily = $this->productFamilyStore->setSection($orderShop->getSection())->getOneBySlug(
$orderProductAdd->getProduct()->getProductFamily()->getSlug()
);
if($productFamily) {
$this->orderProductBuilder->initReductionCatalog($orderShop->getSection(), $orderProductAdd, $productFamily);
}
}
foreach ($orderShop->getOrderProducts() as $orderProduct) { foreach ($orderShop->getOrderProducts() as $orderProduct) {
if ($this->orderProductSolver->compare($orderProduct, $orderProductAdd)) { if ($this->orderProductSolver->compare($orderProduct, $orderProductAdd)) {
$orderProduct->setQuantityOrder( $orderProduct->setQuantityOrder(

Loading…
Cancel
Save