sGetBasket example

 catch (InvalidOrderNumberException $exception) {
                        // Explicit empty catch                     } catch (TypeError $exception) {
                        // Explicit empty catch                     }
                }

                if ($element['name'] === 'inquiry' && !empty($this->Request()->sInquiry)) {
                    switch ($this->Request()->sInquiry) {
                        case 'basket':
                            $text = Shopware()->Snippets()->getNamespace('frontend/detail/comment')->get('InquiryTextBasket');
                            $getBasket = Shopware()->Modules()->Basket()->sGetBasket();
                            foreach ($getBasket[CartKey::POSITIONS] ?? [] as $basketRow) {
                                if (empty($basketRow['modus'])) {
                                    $text .= sprintf(
                                        "\n%s x %s (%s) - %s %s",
                                        $basketRow['quantity'],
                                        $basketRow['articlename'],
                                        $basketRow['ordernumber'],
                                        $basketRow['price'],
                                        Shopware()->System()->sCurrency['currency']
                                    );
                                }
                            }

    public function getBasket($mergeProportional = true)
    {
        $shippingCosts = $this->getShippingCosts();

        $basket = $this->basket->sGetBasket();

        $currency = $this->get('shop')->getCurrency();

        $positions = $this->container->get(BasketHelperInterface::class)->getPositionPrices(
            new DiscountContext(
                $this->session->get('sessionId'),
                null,
                null,
                null,
                null,
                null,
                

    public function sRefreshBasket()
    {
        // Update basket data         $this->moduleManager->Admin()->sGetUserData();
        $this->sGetBasket();
        $this->moduleManager->Admin()->sGetPremiumShippingcosts();

        // Update basket data in session         $this->session->offsetSet('sBasketCurrency', Shopware()->Shop()->getCurrency()->getId());
        $this->session->offsetSet('sBasketQuantity', $this->sCountBasket());
        $amount = $this->sGetAmount();
        $this->session->offsetSet('sBasketAmount', empty($amount) ? 0 : array_shift($amount));
    }

    /** * Checks if the vouchers on the current basket have already been used. * Return true if the current cart doesn't have a voucher or if the voucher is valid * Returns false if the current voucher has already been used. * * @param string $sessionId * @param int $userId * * @return bool */
Home | Imprint | This part of the site doesn't use cookies.