Bläddra i källkod

Correctif reductionCatalog #14

develop
Fabien Normand 2 år sedan
förälder
incheckning
76e38355c0
2 ändrade filer med 10 tillägg och 5 borttagningar
  1. +1
    -4
      Builder/Order/OrderProductBuilder.php
  2. +9
    -1
      Builder/Order/OrderShopBuilder.php

+ 1
- 4
Builder/Order/OrderProductBuilder.php Visa fil

@@ -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 Visa fil

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

Laddar…
Avbryt
Spara