|
|
@@ -59,22 +59,24 @@ class OrderProductBuilder |
|
|
|
|
|
|
|
public function initReductionCatalog(SectionInterface $section, OrderProductInterface $orderProduct, ProductFamilyInterface $productFamily = null): OrderProductInterface |
|
|
|
{ |
|
|
|
if(is_null($productFamily)) { |
|
|
|
$productFamily = $this->productFamilyStore->setSection($section)->getOneBySlug( |
|
|
|
$orderProduct->getProduct()->getProductFamily()->getSlug() |
|
|
|
); |
|
|
|
} |
|
|
|
if(!$orderProduct->getOrderProductReductionCatalog()) { |
|
|
|
if (is_null($productFamily)) { |
|
|
|
$productFamily = $this->productFamilyStore->setSection($section)->getOneBySlug( |
|
|
|
$orderProduct->getProduct()->getProductFamily()->getSlug() |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
$reductionCatalog = $productFamily->getReductionCatalog(); |
|
|
|
if ($reductionCatalog && $reductionCatalog->getStatus()) { |
|
|
|
$orderProductReductionCatalog = $this->orderProductReductionCatalogFactory->create( |
|
|
|
$reductionCatalog->getTitle(), |
|
|
|
$reductionCatalog->getValue(), |
|
|
|
$reductionCatalog->getUnit(), |
|
|
|
$reductionCatalog->getBehaviorTaxRate() |
|
|
|
); |
|
|
|
$reductionCatalog = $productFamily->getReductionCatalog(); |
|
|
|
if ($reductionCatalog && $reductionCatalog->getStatus()) { |
|
|
|
$orderProductReductionCatalog = $this->orderProductReductionCatalogFactory->create( |
|
|
|
$reductionCatalog->getTitle(), |
|
|
|
$reductionCatalog->getValue(), |
|
|
|
$reductionCatalog->getUnit(), |
|
|
|
$reductionCatalog->getBehaviorTaxRate() |
|
|
|
); |
|
|
|
|
|
|
|
$orderProduct->setOrderProductReductionCatalog($orderProductReductionCatalog); |
|
|
|
$orderProduct->setOrderProductReductionCatalog($orderProductReductionCatalog); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $orderProduct; |