createAddresses example

$order->setTransactionId('');
        $order->setTrackingCode('');
        $order->setReferer('');

        $order->fromArray($params);

        $violations = $this->getManager()->validate($order);
        if ($violations->count() > 0) {
            throw new ValidationException($violations);
        }

        $this->createAddresses($params$order);

        // Generate an order number if none was provided. Doing it after validation since         // the generation of the order number cannot be reverted in a simple manner.         if ($order->getNumber() === null) {
            $orderNumberGenerator = Shopware()->Container()->get(NumberRangeIncrementerInterface::class);
            $orderNumber = $orderNumberGenerator->increment('invoice');

            $order->setNumber((string) $orderNumber);
            foreach ($order->getDetails() as $detail) {
                $detail->setNumber((string) $orderNumber);
            }
        }
Home | Imprint | This part of the site doesn't use cookies.