Bläddra i källkod

Correctif reductionCatalog

packProduct
Fabien Normand 2 år sedan
förälder
incheckning
505fb8fb4c
1 ändrade filer med 13 tillägg och 2 borttagningar
  1. +13
    -2
      Solver/Price/PriceSolverTrait.php

+ 13
- 2
Solver/Price/PriceSolverTrait.php Visa fil

@@ -54,6 +54,16 @@ trait PriceSolverTrait
$round = true
): ?float {


if($entity instanceof ProductFamilyInterface) {
$taxRate = $this->productFamilySolver->getTaxRateInherited($entity)->getValue();
}else if ($entity instanceof ProductInterface) {
$taxRate = $this->productSolver->getTaxRateInherited($entity)->getValue();
}else{
$taxRate = $entity->getTaxRate();
}


if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit();
@@ -96,7 +106,7 @@ trait PriceSolverTrait
$price,
$reductionCatalogValue * $quantity
),
$this->productFamilySolver->getTaxRateInherited($entity)->getValue()
$taxRate
);
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount(
@@ -110,7 +120,8 @@ trait PriceSolverTrait
if ($withTax) {
$priceReturn = $priceWithTax;
} else {
$priceReturn = $this->applyPercentNegative($priceWithTax, $this->productFamilySolver->getTaxRateInherited($entity)->getValue());

$priceReturn = $this->applyPercentNegative($priceWithTax, $taxRate);
}
if ($round) {
return $this->round($priceReturn);

Laddar…
Avbryt
Spara