source/Application/Model/BasketItem.php
public function getArticle($blCheckProduct = false, $sProductId = null, $blDisableLazyLoading = false)
    {
        if ($this->_oArticle === null || (!$this->_oArticle->isOrderArticle() && $blDisableLazyLoading)) {
            $sProductId = $sProductId ? $sProductId : $this->_sProductId;
            if (!$sProductId) {
                //this exception may not be caught, anyhow this is a critical exception
                /** @var \OxidEsales\Eshop\Core\Exception\ArticleException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ArticleException::class);
                $oEx->setMessage('EXCEPTION_ARTICLE_NOPRODUCTID');
                throw $oEx;
            }

            $this->_oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
            // #M773 Do not use article lazy loading on order save
            if ($blDisableLazyLoading) {
                $this->_oArticle->modifyCacheKey('_allviews');
                $this->_oArticle->disableLazyLoading();
            }

            // performance:
            // - skipping variants loading
            // - skipping 'ab' price info
            // - load parent field
            $this->_oArticle->setNoVariantLoading(true);
            $this->_oArticle->setLoadParentData(true);
            if (!$this->_oArticle->load($sProductId)) {
                /** @var \OxidEsales\Eshop\Core\Exception\NoArticleException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\NoArticleException::class);
                $oLang = \OxidEsales\Eshop\Core\Registry::getLang();
                $oEx->setMessage(sprintf($oLang->translateString('ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $sProductId));
                $oEx->setArticleNr($sProductId);
                $oEx->setProductId($sProductId);
                throw $oEx;
            }

            // cant put not visible product to basket (M:1286)
            if ($blCheckProduct && !$this->_oArticle->isVisible()) {
                /** @var \OxidEsales\Eshop\Core\Exception\NoArticleException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\NoArticleException::class);
                $oLang = \OxidEsales\Eshop\Core\Registry::getLang();
                $oEx->setMessage(sprintf($oLang->translateString('ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $this->_oArticle->oxarticles__oxartnum->value));
                $oEx->setArticleNr($sProductId);
                $oEx->setProductId($sProductId);
                throw $oEx;
            }

            // cant put not buyable product to basket
            if ($blCheckProduct && !$this->_oArticle->isBuyable()) {
                /** @var \OxidEsales\Eshop\Core\Exception\ArticleInputException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ArticleInputException::class);
                $oEx->setMessage('ERROR_MESSAGE_ARTICLE_ARTICLE_NOT_BUYABLE');
                $oEx->setArticleNr($sProductId);
                $oEx->setProductId($sProductId);
                throw $oEx;
            }
        }

        return $this->_oArticle;
    }
public function getArticle($blCheckProduct = false, $sProductId = null, $blDisableLazyLoading = false)
    {
        if ($this->_oArticle === null || (!$this->_oArticle->isOrderArticle() && $blDisableLazyLoading)) {
            $sProductId = $sProductId ? $sProductId : $this->_sProductId;
            if (!$sProductId) {
                //this exception may not be caught, anyhow this is a critical exception
                /** @var \OxidEsales\Eshop\Core\Exception\ArticleException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ArticleException::class);
                $oEx->setMessage('EXCEPTION_ARTICLE_NOPRODUCTID');
                throw $oEx;
            }

            $this->_oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
            // #M773 Do not use article lazy loading on order save
            if ($blDisableLazyLoading) {
                $this->_oArticle->modifyCacheKey('_allviews');
                $this->_oArticle->disableLazyLoading();
            }

            // performance:
            // - skipping variants loading
            // - skipping 'ab' price info
            // - load parent field
            $this->_oArticle->setNoVariantLoading(true);
            $this->_oArticle->setLoadParentData(true);
            if (!$this->_oArticle->load($sProductId)) {
                /** @var \OxidEsales\Eshop\Core\Exception\NoArticleException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\NoArticleException::class);
                $oLang = \OxidEsales\Eshop\Core\Registry::getLang();
                $oEx->setMessage(sprintf($oLang->translateString('ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $sProductId));
                $oEx->setArticleNr($sProductId);
                $oEx->setProductId($sProductId);
                throw $oEx;
            }

            // cant put not visible product to basket (M:1286)
            if ($blCheckProduct && !$this->_oArticle->isVisible()) {
                /** @var \OxidEsales\Eshop\Core\Exception\NoArticleException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\NoArticleException::class);
                $oLang = \OxidEsales\Eshop\Core\Registry::getLang();
                $oEx->setMessage(sprintf($oLang->translateString('ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $this->_oArticle->oxarticles__oxartnum->value));
                $oEx->setArticleNr($sProductId);
                $oEx->setProductId($sProductId);
                throw $oEx;
            }

            // cant put not buyable product to basket
            if ($blCheckProduct && !$this->_oArticle->isBuyable()) {
                /** @var \OxidEsales\Eshop\Core\Exception\ArticleInputException $oEx */
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ArticleInputException::class);
                $oEx->setMessage('ERROR_MESSAGE_ARTICLE_ARTICLE_NOT_BUYABLE');
                $oEx->setArticleNr($sProductId);
                $oEx->setProductId($sProductId);
                throw $oEx;
            }
        }

        return $this->_oArticle;
    }
public function getArticle ( $ blCheckProduct = false , $ sProductId = null , $ blDisableLazyLoading = false ) { if ( $ this -> _oArticle === null || ( ! $ this -> _oArticle -> isOrderArticle ( ) && $ blDisableLazyLoading ) ) { $ sProductId = $ sProductId ? $ sProductId : $ this -> _sProductId ; if ( ! $ sProductId ) { //this exception may not be caught, anyhow this is a critical exception /** @var \OxidEsales\Eshop\Core\Exception\ArticleException $oEx */ $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ArticleException :: class ) ; $ oEx -> setMessage ( 'EXCEPTION_ARTICLE_NOPRODUCTID' ) ; throw $ oEx ; } $ this -> _oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; // #M773 Do not use article lazy loading on order save if ( $ blDisableLazyLoading ) { $ this -> _oArticle -> modifyCacheKey ( '_allviews' ) ; $ this -> _oArticle -> disableLazyLoading ( ) ; } // performance: // - skipping variants loading // - skipping 'ab' price info // - load parent field $ this -> _oArticle -> setNoVariantLoading ( true ) ; $ this -> _oArticle -> setLoadParentData ( true ) ; if ( ! $ this -> _oArticle -> load ( $ sProductId ) ) { /** @var \OxidEsales\Eshop\Core\Exception\NoArticleException $oEx */ $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ NoArticleException :: class ) ; $ oLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ oEx -> setMessage ( sprintf ( $ oLang -> translateString ( 'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST' , $ oLang -> getBaseLanguage ( ) ) , $ sProductId ) ) ; $ oEx -> setArticleNr ( $ sProductId ) ; $ oEx -> setProductId ( $ sProductId ) ; throw $ oEx ; } // cant put not visible product to basket (M:1286) if ( $ blCheckProduct && ! $ this -> _oArticle -> isVisible ( ) ) { /** @var \OxidEsales\Eshop\Core\Exception\NoArticleException $oEx */ $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ NoArticleException :: class ) ; $ oLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ oEx -> setMessage ( sprintf ( $ oLang -> translateString ( 'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST' , $ oLang -> getBaseLanguage ( ) ) , $ this -> _oArticle -> oxarticles__oxartnum -> value ) ) ; $ oEx -> setArticleNr ( $ sProductId ) ; $ oEx -> setProductId ( $ sProductId ) ; throw $ oEx ; } // cant put not buyable product to basket if ( $ blCheckProduct && ! $ this -> _oArticle -> isBuyable ( ) ) { /** @var \OxidEsales\Eshop\Core\Exception\ArticleInputException $oEx */ $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ArticleInputException :: class ) ; $ oEx -> setMessage ( 'ERROR_MESSAGE_ARTICLE_ARTICLE_NOT_BUYABLE' ) ; $ oEx -> setArticleNr ( $ sProductId ) ; $ oEx -> setProductId ( $ sProductId ) ; throw $ oEx ; } } return $ this -> _oArticle ; }
Retrieves the article .Throws an exception if article does not exist,
is not buyable or visible.

@param bool   $blCheckProduct       checks if product is buyable and visible
@param string $sProductId           product id
@param bool   $blDisableLazyLoading disable lazy loading

@throws oxArticleException exception in case of no current object product id is set
@throws oxNoArticleException exception in case if product not exitst or not visible
@throws oxArticleInputException exception if product is not buyable (stock and so on)

@return \OxidEsales\Eshop\Application\Model\Article|oxOrderArticle
Retrieves the article . Throws an exception if article does not exist is not buyable or visible .