Order example

/** * @deprecated in 5.6, will be protected in 5.8 * * Create temporary order in s_order_basket on confirm page * Used to track failed / aborted orders * * @return void */
    public function saveTemporaryOrder()
    {
        $order = Shopware()->Modules()->Order();

        $normalizer = $this->container->get('shopware.components.cart.proportional_cart_normalizer');

        $order->sUserData = $this->View()->getAssign('sUserData');
        $order->sComment = $this->session['sComment'] ?? '';
        $order->sBasketData = $normalizer->normalize($this->View()->getAssign('sBasket'));
        $order->sAmount = $this->View()->getAssign('sBasket')[CheckoutKey::AMOUNT];
        $order->sAmountWithTax = !empty($this->View()->getAssign('sBasket')[CartKey::AMOUNT_WITH_TAX_NUMERIC]) ? $this->View()->getAssign('sBasket')[CartKey::AMOUNT_WITH_TAX_NUMERIC] : $this->View()->getAssign('sBasket')[CartKey::AMOUNT_NUMERIC];
        $order->sAmountNet = $this->View()->getAssign('sBasket')[CartKey::AMOUNT_NET_NUMERIC];
        $order->sShippingcosts = $this->View()->getAssign('sBasket')[CheckoutKey::SHIPPING_COSTS];
        $order->sShippingcostsNumeric = $this->View()->getAssign('sBasket')[CheckoutKey::SHIPPING_COSTS_WITH_TAX];
        
$paymentUniqueId,
                Shopware()->Session()->get('sUserId'),
            ]);

        if (empty($orderNumber)) {
            $user = $this->getUser();
            $basket = $this->getBasket();
            if (!\is_array($basket)) {
                throw new RuntimeException('Cart must not be empty at this point');
            }

            $order = Shopware()->Modules()->Order();
            $order->sUserData = $user;
            $order->sComment = Shopware()->Session()->get('sComment');
            $order->sBasketData = $basket;
            $order->sAmount = $basket[CheckoutKey::AMOUNT];
            $order->sAmountWithTax = !empty($basket[CartKey::AMOUNT_WITH_TAX_NUMERIC]) ? $basket[CartKey::AMOUNT_WITH_TAX_NUMERIC] : $basket[CartKey::AMOUNT_NUMERIC];
            $order->sAmountNet = $basket[CartKey::AMOUNT_NET_NUMERIC];
            $order->sShippingcosts = $basket[CheckoutKey::SHIPPING_COSTS];
            $order->sShippingcostsNumeric = $basket[CheckoutKey::SHIPPING_COSTS_WITH_TAX];
            $order->sShippingcostsNumericNet = $basket[CheckoutKey::SHIPPING_COSTS_NET];
            $order->bookingId = $transactionId;
            $order->dispatchId = Shopware()->Session()->get('sDispatch');
            
$this->View()->assign([
                'success' => false,
                'data' => $data,
                'message' => $namespace->get('no_data_passed', 'No mail data passed'),
            ]);

            return;
        }

        $mailTemplateName = $this->Request()->getParam('templateName') ?: 'sORDERDOCUMENTS';

        $mail = $this->container->get('modules')->Order()->createStatusMail($orderId, 0, $mailTemplateName);
        if (!$mail instanceof Enlight_Components_Mail) {
            $this->View()->assign([
                'success' => false,
                'message' => 'Could not create mail object.',
            ]);

            return;
        }

        $mail->clearRecipients();
        $mail->clearSubject();
        
Home | Imprint | This part of the site doesn't use cookies.