Selaa lähdekoodia

Correctif reductionCatalog #14

develop
Fabien Normand 2 vuotta sitten
vanhempi
commit
76e38355c0
2 muutettua tiedostoa jossa 10 lisäystä ja 5 poistoa
  1. +1
    -4
      Builder/Order/OrderProductBuilder.php
  2. +9
    -1
      Builder/Order/OrderShopBuilder.php

+ 1
- 4
Builder/Order/OrderProductBuilder.php Näytä tiedosto

@@ -57,12 +57,9 @@ class OrderProductBuilder
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 (is_null($productFamily)) {
$productFamily = $orderProduct->getProduct()->getProductFamily();
}

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

+ 9
- 1
Builder/Order/OrderShopBuilder.php Näytä tiedosto

@@ -246,8 +246,16 @@ class OrderShopBuilder
$updated = false;

$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) {
if ($this->orderProductSolver->compare($orderProduct, $orderProductAdd)) {
$orderProduct->setQuantityOrder(

Loading…
Peruuta
Tallenna