getBasket example

$country = $this->getSelectedCountry();
        $this->View()->assign('sCountry', $country);
        $this->View()->assign('sPayment', $this->getSelectedPayment());
        $this->View()->assign('sDispatch', $this->getSelectedDispatch());
        $this->View()->assign('sCountryList', $this->getCountryList());
        $this->View()->assign('sPayments', $this->getPayments());
        $this->View()->assign('sDispatches', $this->getDispatches());
        $this->View()->assign('sDispatchNoOrder', $accountMode === Customer::ACCOUNT_MODE_CUSTOMER && $this->getDispatchNoOrder());
        $this->View()->assign('sState', $this->getSelectedState());

        $this->View()->assign('sUserData', $this->getUserData());
        $this->View()->assign('sBasket', $this->getBasket());
        $this->View()->assign('sInvalidCartItems', $this->getInvalidProducts($this->View()->getAssign('sBasket')));

        $this->View()->assign(CheckoutKey::SHIPPING_COSTS, $this->View()->getAssign('sBasket')[CheckoutKey::SHIPPING_COSTS]);
        $this->View()->assign(CheckoutKey::SHIPPING_COSTS_DIFFERENCE, $this->View()->getAssign('sBasket')[CheckoutKey::SHIPPING_COSTS_DIFFERENCE] ?? null);
        $this->View()->assign(CheckoutKey::AMOUNT, $this->View()->getAssign('sBasket')[CheckoutKey::AMOUNT]);
        $this->View()->assign(CheckoutKey::AMOUNT_WITH_TAX, $this->View()->getAssign('sBasket')[CheckoutKey::AMOUNT_WITH_TAX] ?? 0.0);
        $this->View()->assign(CheckoutKey::AMOUNT_TAX, $this->View()->getAssign('sBasket')[CheckoutKey::AMOUNT_TAX]);
        $this->View()->assign('sAmountNet', $this->View()->getAssign('sBasket')[CartKey::AMOUNT_NET_NUMERIC]);

        $this->View()->assign('sMinimumSurcharge', $this->getMinimumCharge());
        $this->View()->assign('sPremiums', $this->getPremiums());

        

        $orderNumber = Shopware()->Db()->fetchOne($sql[
                $transactionId,
                $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];
            
Home | Imprint | This part of the site doesn't use cookies.