sCountBasket example

$name = $this->cartOrderNumberProvider->get(CartOrderNumberProviderInterface::SURCHARGE);

        // Delete previous inserted discounts         $this->connection->createQueryBuilder()
            ->where('sessionID = :sessionId')
            ->andWhere('ordernumber IN (:names)')
            ->setParameter('names', $this->cartOrderNumberProvider->getAll(CartOrderNumberProviderInterface::SURCHARGE), Connection::PARAM_STR_ARRAY)
            ->setParameter('sessionId', $this->session->get('sessionId'))
            ->delete('s_order_basket')
            ->execute();

        if (!$this->sCountBasket()) {
            return false;
        }

        $minimumOrder = $this->sSYSTEM->sUSERGROUPDATA['minimumorder'];
        $minimumOrderSurcharge = $this->sSYSTEM->sUSERGROUPDATA['minimumordersurcharge'];
        if (!$minimumOrder || !$minimumOrderSurcharge) {
            return null;
        }

        $amount = $this->sGetAmount();

        
public function flagPaymentBlocked()
    {
        $this->View()->assign('paymentBlocked', true);
    }

    /** * Save basket to session */
    public function postDispatch()
    {
        $this->session->set('sBasketCurrency', Shopware()->Shop()->getCurrency()->getId());
        $this->session->set('sBasketQuantity', $this->basket->sCountBasket());
        $amount = $this->basket->sGetAmount();
        $this->session->set('sBasketAmount', empty($amount) ? 0 : array_shift($amount));

        if (($messageType = $this->Request()->query->get('removeMessage')) && $messageType === 'voucher') {
            $this->session->offsetUnset('sBasketVoucherRemovedInCart');
        }

        if ($this->session->offsetExists('sBasketVoucherRemovedInCart')) {
            $this->View()->assign('sBasketVoucherRemovedInCart', true);
        }
    }

    
private function isUserLoggedIn(): bool
    {
        return !empty($this->get('session')->offsetGet('sUserId'));
    }

    private function shouldRedirectToAccount(): bool
    {
        if (!$this->isUserLoggedIn()) {
            return false;
        }

        return $this->Request()->getParam('sValidation') || !Shopware()->Modules()->Basket()->sCountBasket();
    }

    private function shouldRedirectToCheckout(): bool
    {
        return $this->isUserLoggedIn();
    }

    private function shouldRedirectToTarget(): bool
    {
        return $this->isUserLoggedIn() && empty($this->get('session')->offsetGet('sRegisterFinished'));
    }

    
Home | Imprint | This part of the site doesn't use cookies.