source/Application/Component/BasketComponent.php
protected function addItemToBasket($basket, $itemData, $errorDestination)
    {
        $basketItem = null;

        try {
            $basketItem = $basket->addToBasket(
                $itemData['id'],
                $itemData['amount'],
                $itemData['selectList'],
                $itemData['persistentParameters'],
                $itemData['override'],
                $itemData['bundle'],
                $itemData['oldBasketItemId']
            );
        } catch (\OxidEsales\Eshop\Core\Exception\OutOfStockException $exception) {
            $exception->setDestination($errorDestination);
            // #950 Change error destination to basket popup
            if (!$errorDestination && \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iNewBasketItemMessage') == 2) {
                $errorDestination = 'popup';
            }
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($exception, false, (bool) $errorDestination, $errorDestination);
        } catch (\OxidEsales\Eshop\Core\Exception\ArticleInputException $exception) {
            //add to display at specific position
            $exception->setDestination($errorDestination);
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($exception, false, (bool) $errorDestination, $errorDestination);
        } catch (\OxidEsales\Eshop\Core\Exception\NoArticleException $exception) {
            //ignored, best solution F ?
        }

        return $basketItem;
    }
protected function addItemToBasket($basket, $itemData, $errorDestination)
    {
        $basketItem = null;

        try {
            $basketItem = $basket->addToBasket(
                $itemData['id'],
                $itemData['amount'],
                $itemData['selectList'],
                $itemData['persistentParameters'],
                $itemData['override'],
                $itemData['bundle'],
                $itemData['oldBasketItemId']
            );
        } catch (\OxidEsales\Eshop\Core\Exception\OutOfStockException $exception) {
            $exception->setDestination($errorDestination);
            // #950 Change error destination to basket popup
            if (!$errorDestination && \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iNewBasketItemMessage') == 2) {
                $errorDestination = 'popup';
            }
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($exception, false, (bool) $errorDestination, $errorDestination);
        } catch (\OxidEsales\Eshop\Core\Exception\ArticleInputException $exception) {
            //add to display at specific position
            $exception->setDestination($errorDestination);
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($exception, false, (bool) $errorDestination, $errorDestination);
        } catch (\OxidEsales\Eshop\Core\Exception\NoArticleException $exception) {
            //ignored, best solution F ?
        }

        return $basketItem;
    }
protected function addItemToBasket ( $ basket , $ itemData , $ errorDestination ) { $ basketItem = null ; try { $ basketItem = $ basket -> addToBasket ( $ itemData [ 'id' ] , $ itemData [ 'amount' ] , $ itemData [ 'selectList' ] , $ itemData [ 'persistentParameters' ] , $ itemData [ 'override' ] , $ itemData [ 'bundle' ] , $ itemData [ 'oldBasketItemId' ] ) ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ OutOfStockException $ exception ) { $ exception -> setDestination ( $ errorDestination ) ; // #950 Change error destination to basket popup if ( ! $ errorDestination && \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iNewBasketItemMessage' ) == 2 ) { $ errorDestination = 'popup' ; } \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ exception , false , ( bool ) $ errorDestination , $ errorDestination ) ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ ArticleInputException $ exception ) { //add to display at specific position $ exception -> setDestination ( $ errorDestination ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ exception , false , ( bool ) $ errorDestination , $ errorDestination ) ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ NoArticleException $ exception ) { //ignored, best solution F ? } return $ basketItem ; }
Add one item to basket. Handle eventual errors.

@param \OxidEsales\Eshop\Application\Model\Basket $basket
@param array                                      $itemData
@param string                                     $errorDestination

@return null|oxBasketItem
Add one item to basket . Handle eventual errors .