protected function getOrderHandler(ItemInterface $cartItem) { $type = $cartItem->getProduct()->getType(); if (!isset($this->handlers[$type])) { //Fall back to the default handler return $this->handlers['default']; } return $this->handlers[$type]; }
protected function determineOrderItemUpCharge(ItemInterface $orderItem, $pricingContext) { $upCharge = 0; foreach ($orderItem->getOptions() as $type => $value) { if ($productOption = $orderItem->getProduct()->getOptionSet(array($type => $value))) { $upCharge += $productOption->getUpcharge(); } } return $upCharge; }
function determineOrderItemPrices(ItemInterface $item, PricingContextInterface $pricingContext) { $productPricing = $item->getProduct()->getPricing(); $itemPricing = $productPricing->process($pricingContext); $item->setPricing($itemPricing); }
protected function initOrderItem(ItemInterface $item) { if ($product = $item->getProduct()) { $item->setName($product->getName()); $item->setPrices($product->getPrices()); } }