Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated orderpricing

  • Loading branch information...
commit 9f284c35d238fea18e2c3804b868de1b7183d30e 1 parent e4ad35e
Theodor Diaconu theodorDiaconu authored iampersistent committed
Showing with 4 additions and 6 deletions.
  1. +4 −6 lib/ImmersiveLabs/Pricing/Provider/OrderPricingProvider.php
10 lib/ImmersiveLabs/Pricing/Provider/OrderPricingProvider.php
View
@@ -44,11 +44,10 @@ public function determineOrderPrices(OrderInterface $order, PricingContextInterf
// updating prices for each item
foreach ($order->getItems() as $item) {
/** @var ItemInterface $item */
- $pricing = $item->getPricing();
- $itemsTotalNet += $pricing->getTotalValue();
+ $itemsTotalNet += $item->getPricing()->getNetValue();
}
- $orderPricingSet->set('totalValue', $itemsTotalNet);
+ $orderPricingSet->set('totalNet', $itemsTotalNet);
// if pricing context has taxation enabled we calculate the taxes with the percentage set
// example taxRates : 0.10 for 10%, 0.25 for 25%
@@ -56,8 +55,8 @@ public function determineOrderPrices(OrderInterface $order, PricingContextInterf
$rate = $this->taxProvider->getTaxByState($state);
$totalTax = $itemsTotalNet * $rate;
$orderPricingSet->set('taxRate', $rate);
- $orderPricingSet->set('totalTax', $totalTax);
- $orderPricingSet->set('totalGross', $itemsTotalNet + $totalTax);
+ $orderPricingSet->set('taxes', $totalTax);
+ $orderPricingSet->set('totalValue', $itemsTotalNet + $totalTax);
}
$orderPricingSet->setProcessingState(PricingSet::PROCESSING_FINISHED);
@@ -78,7 +77,6 @@ function determineOrderItemPrices(ItemInterface $item, PricingContextInterface $
{
$productPricing = $item->getProduct()->getPricing();
$itemPricing = $productPricing->process($pricingContext);
-
$item->setPricing($itemPricing);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.