Quellcode durchsuchen

Prix : correctif bug réduction catalogue sur OrderProduct (quantités > 1)

feature/export_comptable
Guillaume vor 4 Jahren
Ursprung
Commit
49168c738f
2 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen
  1. +4
    -1
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  2. +4
    -3
      ShopBundle/Services/Price/PriceUtilsTrait.php

+ 4
- 1
ShopBundle/Services/Price/OrderProductPriceUtils.php Datei anzeigen

@@ -56,6 +56,7 @@ class OrderProductPriceUtils
$orderProduct,
$this->getPrice($orderProduct),
$this->getPriceWithTax($orderProduct),
1,
null,
false
);
@@ -95,6 +96,7 @@ class OrderProductPriceUtils
$orderProduct,
$this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct),
$orderProduct->getQuantityOrder(),
null,
false
);
@@ -113,7 +115,8 @@ class OrderProductPriceUtils
return $this->applyReductionCatalog(
$orderProduct,
$this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct)
$this->getTotalWithTax($orderProduct),
$orderProduct->getQuantityOrder()
);
}


+ 4
- 3
ShopBundle/Services/Price/PriceUtilsTrait.php Datei anzeigen

@@ -42,8 +42,9 @@ trait PriceUtilsTrait
return round((($price * $percent)) / 100, 2);
}

public function applyReductionCatalog($entity, $price, $priceWithTax, $reductionCatalog = null, $withTax = true): ?float
public function applyReductionCatalog($entity, $price, $priceWithTax, $quantity = 1, $reductionCatalog = null, $withTax = true): ?float
{

if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit();
@@ -80,14 +81,14 @@ trait PriceUtilsTrait
$priceWithTax = $this->applyTax(
$this->applyReductionAmount(
$price,
$reductionCatalogValue
$reductionCatalogValue * $quantity
),
$entity->getTaxRateInherited()->getValue()
);
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount(
$priceWithTax,
$reductionCatalogValue
$reductionCatalogValue * $quantity
);
}
}

Laden…
Abbrechen
Speichern