Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function collect(CartInterface $cart)
 {
     $totals = $cart->getTotals();
     $totalGrossPrice = $totals->getGrossPrice();
     $shippingCost = $this->collectShippingCost($cart->getShippingMethodCost());
     return round($totalGrossPrice + $shippingCost, 2);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function visitCart(CartInterface $cart)
 {
     $totals = $cart->getTotals();
     $totalGrossAmount = $this->cartTotalsCollector->collectTotalGrossAmount($cart);
     $totalNetAmount = $this->cartTotalsCollector->collectTotalNetAmount($cart);
     $totalTaxAmount = $this->cartTotalsCollector->collectTotalTaxAmount($cart);
     $totalQuantity = $this->cartTotalsCollector->collectTotalQuantity($cart);
     $totalQWeight = $this->cartTotalsCollector->collectTotalWeight($cart);
     $totals->setQuantity($totalQuantity);
     $totals->setWeight($totalQWeight);
     $totals->setGrossPrice($totalGrossAmount);
     $totals->setNetPrice($totalNetAmount);
     $totals->setTaxAmount($totalTaxAmount);
 }