src/Sulu/Bundle/Sales/OrderBundle/Cart/CartManager.php
public function submitCartDirectly(
        ApiOrderInterface $cart,
        UserInterface $user,
        $locale
    ) {
        $orderWasSubmitted = true;

        try {
            $this->checkIfCartIsValid($user, $cart, $locale);

            // set order-date to current date
            $cart->setOrderDate(new \DateTime());

            // change status of order to confirmed
            $this->orderManager->convertStatus($cart, OrderStatus::STATUS_CONFIRMED);

            // order-addresses have to be set to the current contact-addresses
            $this->reApplyOrderAddresses($cart, $user);

            $customer = $user->getContact();

            // send confirmation email to customer
            $this->orderEmailManager->sendCustomerConfirmation(
                $customer->getMainEmail(),
                $cart,
                $customer
            );

            $shopOwnerEmail = null;

            // get responsible person of contacts account
            if ($customer->getMainAccount() &&
                $customer->getMainAccount()->getResponsiblePerson() &&
                $customer->getMainAccount()->getResponsiblePerson()->getMainEmail()
            ) {
                $shopOwnerEmail = $customer->getMainAccount()->getResponsiblePerson()->getMainEmail();
            }

            // send confirmation email to shop owner
            $this->orderEmailManager->sendShopOwnerConfirmation(
                $shopOwnerEmail,
                $cart,
                $customer
            );

            // flush on success
            $this->em->flush();
        } catch (CartSubmissionException $cse) {
            $orderWasSubmitted = false;
        }

        return $orderWasSubmitted;
    }
public function submitCartDirectly(
        ApiOrderInterface $cart,
        UserInterface $user,
        $locale
    ) {
        $orderWasSubmitted = true;

        try {
            $this->checkIfCartIsValid($user, $cart, $locale);

            // set order-date to current date
            $cart->setOrderDate(new \DateTime());

            // change status of order to confirmed
            $this->orderManager->convertStatus($cart, OrderStatus::STATUS_CONFIRMED);

            // order-addresses have to be set to the current contact-addresses
            $this->reApplyOrderAddresses($cart, $user);

            $customer = $user->getContact();

            // send confirmation email to customer
            $this->orderEmailManager->sendCustomerConfirmation(
                $customer->getMainEmail(),
                $cart,
                $customer
            );

            $shopOwnerEmail = null;

            // get responsible person of contacts account
            if ($customer->getMainAccount() &&
                $customer->getMainAccount()->getResponsiblePerson() &&
                $customer->getMainAccount()->getResponsiblePerson()->getMainEmail()
            ) {
                $shopOwnerEmail = $customer->getMainAccount()->getResponsiblePerson()->getMainEmail();
            }

            // send confirmation email to shop owner
            $this->orderEmailManager->sendShopOwnerConfirmation(
                $shopOwnerEmail,
                $cart,
                $customer
            );

            // flush on success
            $this->em->flush();
        } catch (CartSubmissionException $cse) {
            $orderWasSubmitted = false;
        }

        return $orderWasSubmitted;
    }
public function submitCartDirectly ( ApiOrderInterface $ cart , UserInterface $ user , $ locale ) { $ orderWasSubmitted = true ; try { $ this -> checkIfCartIsValid ( $ user , $ cart , $ locale ) ; // set order-date to current date $ cart -> setOrderDate ( new \ DateTime ( ) ) ; // change status of order to confirmed $ this -> orderManager -> convertStatus ( $ cart , OrderStatus :: STATUS_CONFIRMED ) ; // order-addresses have to be set to the current contact-addresses $ this -> reApplyOrderAddresses ( $ cart , $ user ) ; $ customer = $ user -> getContact ( ) ; // send confirmation email to customer $ this -> orderEmailManager -> sendCustomerConfirmation ( $ customer -> getMainEmail ( ) , $ cart , $ customer ) ; $ shopOwnerEmail = null ; // get responsible person of contacts account if ( $ customer -> getMainAccount ( ) && $ customer -> getMainAccount ( ) -> getResponsiblePerson ( ) && $ customer -> getMainAccount ( ) -> getResponsiblePerson ( ) -> getMainEmail ( ) ) { $ shopOwnerEmail = $ customer -> getMainAccount ( ) -> getResponsiblePerson ( ) -> getMainEmail ( ) ; } // send confirmation email to shop owner $ this -> orderEmailManager -> sendShopOwnerConfirmation ( $ shopOwnerEmail , $ cart , $ customer ) ; // flush on success $ this -> em -> flush ( ) ; } catch ( CartSubmissionException $ cse ) { $ orderWasSubmitted = false ; } return $ orderWasSubmitted ; }
Submits a cart

@param ApiOrderInterface $cart
@param string $locale
@param UserInterface $user

@return bool
Submits a cart