entityManager = $entityManager; $this->priceSolver = $priceSolver; $this->orderProductStore = $orderProductStore; $this->productSolver = $productSolver; $this->orderProductSolver = $orderProductSolver; $this->productFamilySolver = $productFamilySolver; $this->orderProductReductionCatalogFactory = $orderProductReductionCatalogFactory; $this->productFamilyStore = $productFamilyStore; } public function init(OrderProductInterface $orderProduct) :OrderProductInterface { $orderProduct->setTitle($this->orderProductSolver->getTitleOrderShop($orderProduct)); $orderProduct->setPrice($this->priceSolver->getPrice($orderProduct->getProduct())); $orderProduct->setBuyingPrice($this->priceSolver->getBuyingPrice($orderProduct->getProduct())); $orderProduct->setUnit($this->productSolver->getUnitInherited($orderProduct->getProduct())); $orderProduct->setTaxRate($this->productFamilySolver->getTaxRateInherited($orderProduct->getProduct())); $orderProduct->setQuantityProduct($this->productSolver->getQuantityInherited($orderProduct->getProduct())); return $orderProduct; } public function initReductionCatalog(SectionInterface $section, OrderProductInterface $orderProduct, ProductFamilyInterface $productFamily = null): OrderProductInterface { 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() ); $orderProduct->setOrderProductReductionCatalog($orderProductReductionCatalog); } } return $orderProduct; } }