|
|
|
|
|
|
|
|
return $this->round($total); |
|
|
return $this->round($total); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getReductionPercent(OrderShopInterface $orderShop) |
|
|
|
|
|
|
|
|
public function getOrderProductTotalWithTaxAndReductionGlobal(OrderShopInterface $orderShop, OrderProductInterface $orderProduct) |
|
|
{ |
|
|
{ |
|
|
$totalWithTax = $this->getTotalOrderProductsWithTax($orderShop); |
|
|
|
|
|
$totalReductionWithTax = $totalWithTax - $this->getTotalOrderProductsWithTaxAndReductions($orderShop); |
|
|
|
|
|
|
|
|
$amount = $this->orderProductPriceResolver->getTotalWithTaxAndReduction($orderProduct, false); |
|
|
|
|
|
|
|
|
return -(($totalReductionWithTax * 100) / $totalWithTax); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
foreach($orderShop->getOrderReductionCarts() as $orderReductionCart) { |
|
|
|
|
|
if($orderReductionCart->getUnit() == 'percent') { |
|
|
|
|
|
$amount = $this->applyPercent($amount, -$orderReductionCart->getValue()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public function getOrderProductTotalWithTaxAndReductionGlobal(OrderShopInterface $orderShop, OrderProductInterface $orderProduct) |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->round($this->applyPercent( |
|
|
|
|
|
$this->orderProductPriceResolver->getTotalWithTaxAndReduction($orderProduct, false), |
|
|
|
|
|
$this->getReductionPercent($orderShop) |
|
|
|
|
|
)); |
|
|
|
|
|
|
|
|
return $this->round($amount); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |