/** * Import a Cart to the Order * * @param Object\CoreShopCart $cart * @return bool * @throws \Exception */ public function importCart(Object\CoreShopCart $cart) { $items = array(); $i = 1; foreach ($cart->getItems() as $cartItem) { $item = new Object\CoreShopOrderItem(); $item->setKey($i); $item->setParent(Object\Service::createFolderByPath($this->getFullPath() . "/items/")); $item->setPublished(true); $item->setProduct($cartItem->getProduct()); $item->setWholesalePrice($cartItem->getProduct()->getWholesalePrice()); $item->setRetailPrice($cartItem->getProduct()->getRetailPrice()); $item->setTax($cartItem->getProduct()->getTax()); $item->setPrice($cartItem->getProduct()->getProductPrice()); $item->setAmount($cartItem->getAmount()); $item->setExtraInformation($cartItem->getExtraInformation()); $item->save(); $items[] = $item; $i++; } $this->setDiscount($cart->getDiscount()); $this->setPriceRule($cart->getPriceRule()); $this->setItems($items); $this->save(); return true; }