232 $this->basketItemKey = $itemKey;
252 $this->_oRegularUnitPrice = $oRegularUnitPrice;
272 public function init($sProductID, $dAmount, $aSel = null, $aPersParam = null, $blBundle = null)
296 $this->
setAmount($oOrderArticle->oxorderarticles__oxamount->value);
297 $this->
_setSelectList($oOrderArticle->getOrderArticleSelectList());
299 $this->
setBundle($oOrderArticle->isBundle());
309 $this->_blIsDiscountArticle = $blIsDiscountArticle;
319 $this->_blCheckArticleStock = $blStatus;
343 public function setAmount($dAmount, $blOverride =
true, $sItemKey = null)
347 $dAmount =
oxRegistry::get(
"oxInputValidator")->validateBasketAmount($dAmount);
362 $this->_dAmount = $dAmount;
364 $this->_dAmount += $dAmount;
369 $dArtStockAmount = $this->
getSession()->getBasket()->getArtStockInBasket($oArticle->getId(), $sItemKey);
370 $iOnStock = $oArticle->checkForStock($this->_dAmount, $dArtStockAmount);
371 if ($iOnStock !==
true) {
372 if ($iOnStock ===
false) {
377 $this->_dAmount = $iOnStock;
384 $this->_dWeight = $oArticle->oxarticles__oxweight->value *
$this->_dAmount;
386 if ($iOnStock !==
true) {
388 $oEx =
oxNew(
'oxOutOfStockException');
389 $oEx->
setMessage(
'ERROR_MESSAGE_OUTOFSTOCK_OUTOFSTOCK');
390 $oEx->
setArticleNr($oArticle->oxarticles__oxartnum->value);
392 $oEx->setRemainingAmount($this->_dAmount);
393 $oEx->setBasketIndex($sItemKey);
405 $this->_oUnitPrice = clone $oPrice;
407 $this->_oPrice = clone $oPrice;
408 $this->_oPrice->multiply($this->
getAmount());
419 if ($this->_sIconUrl === null || $this->_blSsl != $this->
getConfig()->isSsl()) {
420 $this->_sIconUrl = $this->
getArticle()->getIconUrl();
440 public function getArticle($blCheckProduct =
false, $sProductId = null, $blDisableLazyLoading =
false)
442 if ($this->_oArticle === null || (!$this->_oArticle->isOrderArticle() && $blDisableLazyLoading)) {
447 $oEx =
oxNew(
'oxArticleException');
448 $oEx->setMessage(
'EXCEPTION_ARTICLE_NOPRODUCTID');
452 $this->_oArticle =
oxNew(
'oxarticle');
454 if ($blDisableLazyLoading) {
455 $this->_oArticle->modifyCacheKey(
'_allviews');
456 $this->_oArticle->disableLazyLoading();
463 $this->_oArticle->setNoVariantLoading(
true);
464 $this->_oArticle->setLoadParentData(
true);
465 if (!$this->_oArticle->load($sProductId)) {
467 $oEx =
oxNew(
'oxNoArticleException');
469 $oEx->setMessage(sprintf($oLang->translateString(
'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $sProductId));
470 $oEx->setArticleNr($sProductId);
471 $oEx->setProductId($sProductId);
476 if ($blCheckProduct && !$this->_oArticle->isVisible()) {
478 $oEx =
oxNew(
'oxNoArticleException');
480 $oEx->setMessage(sprintf($oLang->translateString(
'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $this->_oArticle->oxarticles__oxartnum->value));
481 $oEx->setArticleNr($sProductId);
482 $oEx->setProductId($sProductId);
487 if ($blCheckProduct && !$this->_oArticle->isBuyable()) {
489 $oEx =
oxNew(
'oxArticleInputException');
490 $oEx->setMessage(
'ERROR_MESSAGE_ARTICLE_ARTICLE_NOT_BUYABLE');
491 $oEx->setArticleNr($sProductId);
492 $oEx->setProductId($sProductId);
507 return $this->
isBundle() ? $this->_dAmount : 0;
560 $this->_sTitle = $oArticle->oxarticles__oxtitle->value;
562 if ($oArticle->oxarticles__oxvarselect->value) {
563 $this->_sTitle = $this->_sTitle .
', ' . $this->
getVarSelect();
581 return $this->
getSession()->processUrl($this->_sLink);
655 if ($sName ==
'oProduct') {
668 foreach (get_object_vars($this) as $sKey => $sVar) {
669 if ($sKey !=
'_oArticle') {
695 $oArticle = $this->
getArticle(
true, $sProductId);
698 $this->_sProductId = $sProductId;
700 $this->_sTitle = null;
701 $this->_sVarSelect = null;
705 $this->_sIcon = $oArticle->oxarticles__oxicon->value;
706 $this->_sIconUrl = $oArticle->getIconUrl();
707 $this->_blSsl = $oConfig->isSsl();
710 $this->_sLink =
oxRegistry::get(
"oxUtilsUrl")->cleanUrl($oArticle->getLink(), array(
'force_sid'));
713 $this->_sShopId = $oConfig->getShopId();
714 $this->_sNativeShopId = $oArticle->oxarticles__oxshopid->value;
717 $this->_sDimageDirNoSsl = $oArticle->nossl_dimagedir;
718 $this->_sDimageDirSsl = $oArticle->ssl_dimagedir;
733 $this->_oArticle = $oOrderArticle;
736 $this->_sProductId = $oOrderArticle->getProductId();
739 $this->_sTitle = $oOrderArticle->oxarticles__oxtitle->value;
742 $this->_sShopId = $this->
getConfig()->getShopId();
743 $this->_sNativeShopId = $oOrderArticle->oxarticles__oxshopid->value;
754 $aSelectLists = $this->
getArticle()->getSelectLists();
755 if (!$aSelList || is_array($aSelList) && count($aSelList) == 0) {
756 if ($iSelCnt = count($aSelectLists)) {
757 $aSelList = array_fill(0, $iSelCnt,
'0');
761 $this->_aSelList = $aSelList;
764 if (count($this->_aSelList) && is_array($this->_aSelList)) {
765 foreach ($this->_aSelList as $conkey => $iSel) {
766 $this->_aChosenSelectlist[$conkey] =
new stdClass();
767 $this->_aChosenSelectlist[$conkey]->name = $aSelectLists[$conkey][
'name'];
768 $this->_aChosenSelectlist[$conkey]->value = $aSelectLists[$conkey][$iSel]->name;
790 $this->_aPersistentParameters = $aPersParam;
800 $this->_blBundle = $blBundle;
810 $this->_blSkipDiscounts = $blSkip;
830 $this->_sWrappingId = $sWrapId;
852 $oWrap =
oxNew(
'oxwrapping');
853 $oWrap->load($sWrapId);
876 $this->_sWishId = $sWishId;
886 $this->_sWishArticleId = $sArticleId;
954 $sVarSelectValue = $oArticle->oxarticles__oxvarselect->value;
955 $this->_sVarSelect = (!empty($sVarSelectValue) || $sVarSelectValue ===
'0') ? $sVarSelectValue :
'';
979 $this->_iLanguageId = $iLanguageId;
982 if ($iOldLang !== null && $iOldLang != $iLanguageId) {