sAddArticle example

$quantity = (int) $this->Request()->getParam('sQuantity');
        $productId = Shopware()->Modules()->Articles()->sGetArticleIdByOrderNumber($orderNumber);
        $instockInfo = $this->getInstockInfo($orderNumber$quantity);

        $this->View()->assign('sBasketInfo', $instockInfo);

        if ($instockInfo !== null) {
            $this->session->offsetSet('sErrorMessages', $instockInfo);
        }

        if (!empty($productId)) {
            $insertId = $this->basket->sAddArticle($orderNumber$quantity);
            $this->View()->assign('sArticleName', Shopware()->Modules()->Articles()->sGetArticleNameByOrderNumber($orderNumber));
            if (!empty($insertId)) {
                $basket = $this->getBasket();
                foreach ($basket[CartKey::POSITIONS] ?? [] as $item) {
                    if ((int) $item['id'] === $insertId) {
                        $this->View()->assign('sArticle', $item);
                        break;
                    }
                }
            }

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