Browse Source

Correctif reductionCatalog

packProduct
Fabien Normand 3 years ago
parent
commit
505fb8fb4c
1 changed files with 13 additions and 2 deletions
  1. +13
    -2
      Solver/Price/PriceSolverTrait.php

+ 13
- 2
Solver/Price/PriceSolverTrait.php View File

$round = true $round = true
): ?float { ): ?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) { if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue(); $reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit(); $reductionCatalogUnit = $reductionCatalog->getUnit();
$price, $price,
$reductionCatalogValue * $quantity $reductionCatalogValue * $quantity
), ),
$this->productFamilySolver->getTaxRateInherited($entity)->getValue()
$taxRate
); );
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') { } elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount( $priceWithTax = $this->applyReductionAmount(
if ($withTax) { if ($withTax) {
$priceReturn = $priceWithTax; $priceReturn = $priceWithTax;
} else { } else {
$priceReturn = $this->applyPercentNegative($priceWithTax, $this->productFamilySolver->getTaxRateInherited($entity)->getValue());

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

Loading…
Cancel
Save