示例#1
0
 /**
  * Loads and returns the article for that basket item
  *
  * @param string $sItemKey the key that will be given to oxarticle setItemKey
  *
  * @throws oxArticleException article exception
  *
  * @return oxArticle
  */
 public function getArticle($sItemKey)
 {
     if (!$this->oxuserbasketitems__oxartid->value) {
         //this exception may not be caught, anyhow this is a critical exception
         $oEx = oxNew('oxArticleException');
         $oEx->setMessage('EXCEPTION_ARTICLE_NOPRODUCTID');
         throw $oEx;
     }
     if ($this->_oArticle === null) {
         $this->_oArticle = oxNew('oxArticle');
         // performance
         /* removed due to #4178
             if ( $this->_blParentBuyable ) {
                $this->_oArticle->setNoVariantLoading( true );
            }
            */
         if (!$this->_oArticle->load($this->oxuserbasketitems__oxartid->value)) {
             return false;
         }
         $aSelList = $this->getSelList();
         if (($aSelectlist = $this->_oArticle->getSelectLists()) && is_array($aSelList)) {
             foreach ($aSelList as $iKey => $iSel) {
                 if (isset($aSelectlist[$iKey][$iSel])) {
                     // cloning select list information
                     $aSelectlist[$iKey][$iSel] = clone $aSelectlist[$iKey][$iSel];
                     $aSelectlist[$iKey][$iSel]->selected = 1;
                 }
             }
             $this->_oArticle->setSelectlist($aSelectlist);
         }
         // generating item key
         $this->_oArticle->setItemKey($sItemKey);
     }
     return $this->_oArticle;
 }