WellCommerce\Bundle\OrderBundle\Entity\OrderInterface::setProductTotal PHP Method

setProductTotal() public method

public setProductTotal ( WellCommerce\Bundle\OrderBundle\Entity\OrderProductTotalInterface $productTotal )
$productTotal WellCommerce\Bundle\OrderBundle\Entity\OrderProductTotalInterface
    public function setProductTotal(OrderProductTotalInterface $productTotal);

Usage Example

示例#1
0
 /**
  * Prepares order product totals
  *
  * @param OrderInterface              $order
  * @param ShippingMethodCostInterface $shippingMethodCost
  */
 protected function prepareProductTotals(OrderInterface $order, CartInterface $cart)
 {
     $cartTotals = $cart->getTotals();
     $baseCurrency = $cart->getCurrency();
     $productTotal = new OrderTotal();
     $productTotal->setGrossAmount($this->currencyHelper->convert($cartTotals->getGrossPrice(), $baseCurrency, $order->getCurrency()));
     $productTotal->setNetAmount($this->currencyHelper->convert($cartTotals->getNetPrice(), $baseCurrency, $order->getCurrency()));
     $productTotal->setTaxAmount($this->currencyHelper->convert($cartTotals->getTaxAmount(), $baseCurrency, $order->getCurrency()));
     $productTotal->setCurrency($order->getCurrency());
     $order->setProductTotal($productTotal);
 }