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 $selectForUpdate =
false;
371 if ($this->
getConfig()->getConfigParam(
'blPsBasketReservationEnabled')) {
372 $selectForUpdate =
true;
374 $iOnStock = $oArticle->checkForStock($this->_dAmount, $dArtStockAmount, $selectForUpdate);
375 if ($iOnStock !==
true) {
376 if ($iOnStock ===
false) {
381 $this->_dAmount = $iOnStock;
388 $this->_dWeight = $oArticle->oxarticles__oxweight->value *
$this->_dAmount;
390 if ($iOnStock !==
true) {
392 $oEx =
oxNew(
'oxOutOfStockException');
393 $oEx->
setMessage(
'ERROR_MESSAGE_OUTOFSTOCK_OUTOFSTOCK');
394 $oEx->
setArticleNr($oArticle->oxarticles__oxartnum->value);
396 $oEx->setRemainingAmount($this->_dAmount);
397 $oEx->setBasketIndex($sItemKey);
409 $this->_oUnitPrice = clone $oPrice;
411 $this->_oPrice = clone $oPrice;
412 $this->_oPrice->multiply($this->
getAmount());
423 if ($this->_sIconUrl === null || $this->_blSsl != $this->
getConfig()->isSsl()) {
424 $this->_sIconUrl = $this->
getArticle()->getIconUrl();
444 public function getArticle($blCheckProduct =
false, $sProductId = null, $blDisableLazyLoading =
false)
446 if ($this->_oArticle === null || (!$this->_oArticle->isOrderArticle() && $blDisableLazyLoading)) {
451 $oEx =
oxNew(
'oxArticleException');
452 $oEx->setMessage(
'EXCEPTION_ARTICLE_NOPRODUCTID');
456 $this->_oArticle =
oxNew(
'oxarticle');
458 if ($blDisableLazyLoading) {
459 $this->_oArticle->modifyCacheKey(
'_allviews');
460 $this->_oArticle->disableLazyLoading();
467 $this->_oArticle->setNoVariantLoading(
true);
468 $this->_oArticle->setLoadParentData(
true);
469 if (!$this->_oArticle->load($sProductId)) {
471 $oEx =
oxNew(
'oxNoArticleException');
473 $oEx->setMessage(sprintf($oLang->translateString(
'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $sProductId));
474 $oEx->setArticleNr($sProductId);
475 $oEx->setProductId($sProductId);
480 if ($blCheckProduct && !$this->_oArticle->isVisible()) {
482 $oEx =
oxNew(
'oxNoArticleException');
484 $oEx->setMessage(sprintf($oLang->translateString(
'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $this->_oArticle->oxarticles__oxartnum->value));
485 $oEx->setArticleNr($sProductId);
486 $oEx->setProductId($sProductId);
491 if ($blCheckProduct && !$this->_oArticle->isBuyable()) {
493 $oEx =
oxNew(
'oxArticleInputException');
494 $oEx->setMessage(
'ERROR_MESSAGE_ARTICLE_ARTICLE_NOT_BUYABLE');
495 $oEx->setArticleNr($sProductId);
496 $oEx->setProductId($sProductId);
511 return $this->
isBundle() ? $this->_dAmount : 0;
564 $this->_sTitle = $oArticle->oxarticles__oxtitle->value;
566 if ($oArticle->oxarticles__oxvarselect->value) {
567 $this->_sTitle = $this->_sTitle .
', ' . $this->
getVarSelect();
585 return $this->
getSession()->processUrl($this->_sLink);
659 if ($sName ==
'oProduct') {
672 foreach (get_object_vars($this) as $sKey => $sVar) {
673 if ($sKey !=
'_oArticle') {
699 $oArticle = $this->
getArticle(
true, $sProductId);
702 $this->_sProductId = $sProductId;
704 $this->_sTitle = null;
705 $this->_sVarSelect = null;
709 $this->_sIcon = $oArticle->oxarticles__oxicon->value;
710 $this->_sIconUrl = $oArticle->getIconUrl();
711 $this->_blSsl = $oConfig->isSsl();
714 $this->_sLink =
oxRegistry::get(
"oxUtilsUrl")->cleanUrl($oArticle->getLink(), array(
'force_sid'));
717 $this->_sShopId = $oConfig->getShopId();
718 $this->_sNativeShopId = $oArticle->oxarticles__oxshopid->value;
721 $this->_sDimageDirNoSsl = $oArticle->nossl_dimagedir;
722 $this->_sDimageDirSsl = $oArticle->ssl_dimagedir;
737 $this->_oArticle = $oOrderArticle;
740 $this->_sProductId = $oOrderArticle->getProductId();
743 $this->_sTitle = $oOrderArticle->oxarticles__oxtitle->value;
746 $this->_sShopId = $this->
getConfig()->getShopId();
747 $this->_sNativeShopId = $oOrderArticle->oxarticles__oxshopid->value;
758 $aSelectLists = $this->
getArticle()->getSelectLists();
759 if (!$aSelList || is_array($aSelList) && count($aSelList) == 0) {
760 if ($iSelCnt = count($aSelectLists)) {
761 $aSelList = array_fill(0, $iSelCnt,
'0');
765 $this->_aSelList = $aSelList;
768 if (count($this->_aSelList) && is_array($this->_aSelList)) {
769 foreach ($this->_aSelList as $conkey => $iSel) {
770 $this->_aChosenSelectlist[$conkey] =
new stdClass();
771 $this->_aChosenSelectlist[$conkey]->name = $aSelectLists[$conkey][
'name'];
772 $this->_aChosenSelectlist[$conkey]->value = $aSelectLists[$conkey][$iSel]->name;
794 $this->_aPersistentParameters = $aPersParam;
804 $this->_blBundle = $blBundle;
814 $this->_blSkipDiscounts = $blSkip;
834 $this->_sWrappingId = $sWrapId;
856 $oWrap =
oxNew(
'oxwrapping');
857 $oWrap->load($sWrapId);
880 $this->_sWishId = $sWishId;
890 $this->_sWishArticleId = $sArticleId;
958 $sVarSelectValue = $oArticle->oxarticles__oxvarselect->value;
959 $this->_sVarSelect = (!empty($sVarSelectValue) || $sVarSelectValue ===
'0') ? $sVarSelectValue :
'';
983 $this->_iLanguageId = $iLanguageId;
986 if ($iOldLang !== null && $iOldLang != $iLanguageId) {