public function validateStock($oBasket)
    {
        foreach ($oBasket->getContents() as $key => $oContent) {
            try {
                $oProd = $oContent->getArticle(true, null, true);
            } catch (\OxidEsales\Eshop\Core\Exception\NoArticleException $oEx) {
                $oBasket->removeItem($key);
                throw $oEx;
            } catch (\OxidEsales\Eshop\Core\Exception\ArticleInputException $oEx) {
                $oBasket->removeItem($key);
                throw $oEx;
            }

            // check if its still available
            $dArtStockAmount = $oBasket->getArtStockInBasket($oProd->getId(), $key);
            $iOnStock = $oProd->checkForStock($oContent->getAmount(), $dArtStockAmount);
            if ($iOnStock !== true) {
                /** @var \OxidEsales\Eshop\Core\Exception\OutOfStockException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\OutOfStockException::class);
                $oEx->setMessage('ERROR_MESSAGE_OUTOFSTOCK_OUTOFSTOCK');
                $oEx->setArticleNr($oProd->oxarticles__oxartnum->value);
                $oEx->setProductId($oProd->getId());
                $oEx->setBasketIndex($key);

                if (!is_numeric($iOnStock)) {
                    $iOnStock = 0;
                }
                $oEx->setRemainingAmount($iOnStock);
                throw $oEx;
            }
        }
    }