226 $this->_oRegularUnitPrice = $oRegularUnitPrice;
246 public function init($sProductID, $dAmount, $aSel = null, $aPersParam = null, $blBundle = null)
249 $this->setAmount($dAmount);
270 $this->setAmount($oOrderArticle->oxorderarticles__oxamount->value);
271 $this->
_setSelectList($oOrderArticle->getOrderArticleSelectList());
273 $this->
setBundle($oOrderArticle->isBundle());
283 $this->_blIsDiscountArticle = $blIsDiscountArticle;
293 $this->_blCheckArticleStock = $blStatus;
317 public function setAmount($dAmount, $blOverride =
true, $sItemKey = null)
321 $dAmount =
oxRegistry::get(
"oxInputValidator")->validateBasketAmount($dAmount);
329 $oArticle = $this->getArticle(
true);
336 $this->_dAmount = $dAmount;
338 $this->_dAmount += $dAmount;
343 $dArtStockAmount = $this->
getSession()->getBasket()->getArtStockInBasket($oArticle->getId(), $sItemKey);
344 $iOnStock = $oArticle->checkForStock($this->_dAmount, $dArtStockAmount);
345 if ($iOnStock !==
true) {
346 if ($iOnStock ===
false) {
351 $this->_dAmount = $iOnStock;
358 $this->_dWeight = $oArticle->oxarticles__oxweight->value *
$this->_dAmount;
360 if ($iOnStock !==
true) {
362 $oEx =
oxNew(
'oxOutOfStockException');
363 $oEx->
setMessage(
'ERROR_MESSAGE_OUTOFSTOCK_OUTOFSTOCK');
364 $oEx->
setArticleNr($oArticle->oxarticles__oxartnum->value);
366 $oEx->setRemainingAmount($this->_dAmount);
367 $oEx->setBasketIndex($sItemKey);
379 $this->_oUnitPrice = clone $oPrice;
381 $this->_oPrice = clone $oPrice;
382 $this->_oPrice->multiply($this->
getAmount());
393 if ($this->_sIconUrl === null || $this->_blSsl != $this->
getConfig()->isSsl()) {
394 $this->_sIconUrl = $this->getArticle()->getIconUrl();
414 public function getArticle($blCheckProduct =
false, $sProductId = null, $blDisableLazyLoading =
false)
416 if ($this->_oArticle === null || (!$this->_oArticle->isOrderArticle() && $blDisableLazyLoading)) {
421 $oEx =
oxNew(
'oxArticleException');
422 $oEx->
setMessage(
'EXCEPTION_ARTICLE_NOPRODUCTID');
426 $this->_oArticle =
oxNew(
'oxarticle');
428 if ($blDisableLazyLoading) {
429 $this->_oArticle->modifyCacheKey(
'_allviews');
430 $this->_oArticle->disableLazyLoading();
437 $this->_oArticle->setNoVariantLoading(
true);
438 $this->_oArticle->setLoadParentData(
true);
439 if (!$this->_oArticle->load($sProductId)) {
441 $oEx =
oxNew(
'oxNoArticleException');
443 $oEx->
setMessage(sprintf($oLang->translateString(
'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $sProductId));
450 if ($blCheckProduct && !$this->_oArticle->isVisible()) {
452 $oEx =
oxNew(
'oxNoArticleException');
454 $oEx->
setMessage(sprintf($oLang->translateString(
'ERROR_MESSAGE_ARTICLE_ARTICLE_DOES_NOT_EXIST', $oLang->getBaseLanguage()), $this->_oArticle->oxarticles__oxartnum->value));
461 if ($blCheckProduct && !$this->_oArticle->isBuyable()) {
463 $oEx =
oxNew(
'oxArticleInputException');
464 $oEx->
setMessage(
'ERROR_MESSAGE_ARTICLE_ARTICLE_NOT_BUYABLE');
481 return $this->
isBundle() ? $this->_dAmount : 0;
533 $oArticle = $this->getArticle();
534 $this->_sTitle = $oArticle->oxarticles__oxtitle->value;
536 if ($oArticle->oxarticles__oxvarselect->value) {
537 $this->_sTitle = $this->_sTitle .
', ' . $this->
getVarSelect();
552 $this->_sLink =
oxRegistry::get(
"oxUtilsUrl")->cleanUrl($this->getArticle()->
getLink(), array(
'force_sid'));
555 return $this->
getSession()->processUrl($this->_sLink);
629 if ($sName ==
'oProduct') {
630 return $this->getArticle();
642 foreach (get_object_vars($this) as $sKey => $sVar) {
643 if ($sKey !=
'_oArticle') {
669 $oArticle = $this->getArticle(
true, $sProductId);
672 $this->_sProductId = $sProductId;
674 $this->_sTitle = null;
675 $this->_sVarSelect = null;
679 $this->_sIcon = $oArticle->oxarticles__oxicon->value;
680 $this->_sIconUrl = $oArticle->getIconUrl();
681 $this->_blSsl = $oConfig->isSsl();
684 $this->_sLink =
oxRegistry::get(
"oxUtilsUrl")->cleanUrl($oArticle->getLink(), array(
'force_sid'));
687 $this->_sShopId = $oConfig->getShopId();
688 $this->_sNativeShopId = $oArticle->oxarticles__oxshopid->value;
691 $this->_sDimageDirNoSsl = $oArticle->nossl_dimagedir;
692 $this->_sDimageDirSsl = $oArticle->ssl_dimagedir;
707 $this->_oArticle = $oOrderArticle;
710 $this->_sProductId = $oOrderArticle->getProductId();
713 $this->_sTitle = $oOrderArticle->oxarticles__oxtitle->value;
716 $this->_sShopId = $this->
getConfig()->getShopId();
717 $this->_sNativeShopId = $oOrderArticle->oxarticles__oxshopid->value;
728 $aSelectLists = $this->getArticle()->getSelectLists();
729 if (!$aSelList || is_array($aSelList) && count($aSelList) == 0) {
730 if ($iSelCnt = count($aSelectLists)) {
731 $aSelList = array_fill(0, $iSelCnt,
'0');
735 $this->_aSelList = $aSelList;
738 if (count($this->_aSelList) && is_array($this->_aSelList)) {
739 foreach ($this->_aSelList as $conkey => $iSel) {
740 $this->_aChosenSelectlist[$conkey] =
new stdClass();
741 $this->_aChosenSelectlist[$conkey]->name = $aSelectLists[$conkey][
'name'];
742 $this->_aChosenSelectlist[$conkey]->value = $aSelectLists[$conkey][$iSel]->name;
764 $this->_aPersistentParameters = $aPersParam;
774 $this->_blBundle = $blBundle;
784 $this->_blSkipDiscounts = $blSkip;
804 $this->_sWrappingId = $sWrapId;
826 $oWrap =
oxNew(
'oxwrapping');
827 $oWrap->load($sWrapId);
850 $this->_sWishId = $sWishId;
860 $this->_sWishArticleId = $sArticleId;
927 $oArticle = $this->getArticle();
928 $this->_sVarSelect = $oArticle->oxarticles__oxvarselect->value ? $oArticle->oxarticles__oxvarselect->value :
'';
952 $this->_iLanguageId = $iLanguageId;
955 if ($iOldLang !== null && $iOldLang != $iLanguageId) {