소스 검색

Correctif prix

packProduct
Guillaume 2 년 전
부모
커밋
ca5f5b2e86
4개의 변경된 파일19개의 추가작업 그리고 13개의 파일을 삭제
  1. +1
    -3
      Builder/Order/OrderProductBuilder.php
  2. +8
    -6
      Solver/Price/OrderProductPriceSolver.php
  3. +2
    -2
      Solver/Price/OrderShopPriceSolver.php
  4. +8
    -2
      Solver/Price/PriceSolverTrait.php

+ 1
- 3
Builder/Order/OrderProductBuilder.php 파일 보기

@@ -61,9 +61,7 @@ class OrderProductBuilder
{
if(!$orderProduct->getOrderProductReductionCatalog()) {
if (is_null($productFamily)) {
$productFamily = $this->productFamilyStore->setSection($section)->getOneBySlug(
$orderProduct->getProduct()->getProductFamily()->getSlug()
);
$productFamily = $orderProduct->getProduct()->getProductFamily();
}

$reductionCatalog = $productFamily->getReductionCatalog();

+ 8
- 6
Solver/Price/OrderProductPriceSolver.php 파일 보기

@@ -102,24 +102,26 @@ class OrderProductPriceSolver
}


public function getTotalWithReduction(OrderProductInterface $orderProduct)
public function getTotalWithReduction(OrderProductInterface $orderProduct, bool $round = true)
{
return $this->applyReductionCatalog(
$orderProduct,
$this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct),
$this->getTotalWithTax($orderProduct, $round),
$orderProduct->getQuantityOrder(),
null,
false
false,
$round
);
}

public function getTotalWithTax(OrderProductInterface $orderProduct)
public function getTotalWithTax(OrderProductInterface $orderProduct, $round = true)
{

return $this->applyTax(
$this->getTotal($orderProduct),
$orderProduct->getTaxRate()->getValue()
$orderProduct->getTaxRate()->getValue(),
$round
);
}

@@ -128,7 +130,7 @@ class OrderProductPriceSolver
return $this->applyReductionCatalog(
$orderProduct,
$this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct),
$this->getTotalWithTax($orderProduct, $round),
$orderProduct->getQuantityOrder(),
null,
true,

+ 2
- 2
Solver/Price/OrderShopPriceSolver.php 파일 보기

@@ -34,7 +34,7 @@ class OrderShopPriceSolver

$total = 0;
foreach ($orderShop->getOrderProducts() as $orderProduct) {
$total += $this->orderProductPriceResolver->getTotalWithReduction($orderProduct);
$total += $this->orderProductPriceResolver->getTotalWithReduction($orderProduct, false);
}
return $this->round($total);
}
@@ -145,7 +145,7 @@ class OrderShopPriceSolver
{
$total = 0;
foreach ($orderProducts as $orderProduct) {
$total += $this->orderProductPriceResolver->getTotalWithTaxAndReduction($orderProduct);
$total += $this->orderProductPriceResolver->getTotalWithTaxAndReduction($orderProduct, false);
}

return $this->round($total);

+ 8
- 2
Solver/Price/PriceSolverTrait.php 파일 보기

@@ -9,9 +9,15 @@ use Lc\CaracoleBundle\Model\Product\ProductInterface;

trait PriceSolverTrait
{
public function applyTax($price, $taxRateValue)
public function applyTax($price, $taxRateValue, $round = true)
{
return $this->round($this->applyPercent($price, $taxRateValue));
$price = $this->applyPercent($price, $taxRateValue);

if($round) {
return $this->round($price);
}

return $price;
}

public function applyReductionPercent($price, $percentage)

Loading…
취소
저장