Ver código fonte

Correctif reductionCatalog

packProduct
Fabien Normand 2 anos atrás
pai
commit
505fb8fb4c
1 arquivos alterados com 13 adições e 2 exclusões
  1. +13
    -2
      Solver/Price/PriceSolverTrait.php

+ 13
- 2
Solver/Price/PriceSolverTrait.php Ver arquivo

@@ -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);

Carregando…
Cancelar
Salvar