55 if ($oConfig->getConfigParam(
'blPsBasketReservationEnabled')) {
56 if ($oReservations = $this->
getSession()->getBasketReservations()) {
57 if (!$oReservations->getTimeLeft()) {
59 if ($oBasket && $oBasket->getProductsCount()) {
60 $oBasket->deleteBasket();
63 $iLimit = (int) $oConfig->getConfigParam(
'iBasketReservationCleanPerRequest');
67 $oReservations->discardUnusedReservations($iLimit);
74 if ($this->
getConfig()->getConfigParam(
'blBasketExcludeEnabled')) {
75 if ($oBasket = $this->
getSession()->getBasket()) {
90 if ($oBasket = $this->
getSession()->getBasket()) {
91 $oBasket->calculateBasket(
false);
114 public function tobasket($sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride =
false)
123 if ($aProducts = $this->
_getItems($sProductId, $dAmount, $aSel, $aPersParam, $blOverride)) {
126 $oBasketItem = $this->
_addItems($aProducts);
129 if ($oBasketItem &&
$myConfig->getConfigParam(
'iNewBasketItemMessage') != 0) {
130 $oNewItem =
new stdClass();
131 $oNewItem->sTitle = $oBasketItem->getTitle();
132 $oNewItem->sId = $oBasketItem->getProductId();
133 $oNewItem->dAmount = $oBasketItem->getAmount();
134 $oNewItem->dBundledAmount = $oBasketItem->getdBundledAmount();
177 if ($sBasketItemId) {
180 $aBasketContents = $oBasket->getContents();
181 $oItem = $aBasketContents[$sBasketItemId];
183 $sProductId = isset($oItem) ? $oItem->getProductId() : null;
195 if ($aProducts = $this->
_getItems($sProductId, $dAmount, $aSel, $aPersParam, $blOverride)) {
199 $oBasket->onUpdate();
202 $oBasketItem = $this->
_addItems($aProducts);
218 $sClass = $sClass ? $sClass .
'?' :
'start?';
222 foreach ($this->aRedirectParams as $sParamName) {
224 $sPosition .= $sParamVal ? $sParamName .
'=' . $sParamVal .
'&' :
'';
230 $sPosition .= $sParam ?
'searchparam=' . $sParam .
'&' :
'';
234 $sPosition .= ($iPageNr > 0) ?
'pgNr=' . $iPageNr .
'&' :
'';
237 if ($this->
getConfig()->getConfigParam(
'iNewBasketItemMessage') == 3) {
246 return $sClass . $sPosition;
282 if (empty($aPersParam)) {
284 if (!is_array($aPersParam) || empty($aPersParam[
'details'])) {
291 $aProducts[$sProductId] = array(
'am' => $dAmount,
293 'persparam' => $aPersParam,
294 'override' => $blOverride,
295 'basketitemid' => $sBasketItemId
299 if (is_array($aProducts) && count($aProducts)) {
303 foreach ($aProducts as $sProductId => $aProduct) {
304 if (isset($aProduct[
'remove']) && $aProduct[
'remove']) {
305 $aProducts[$sProductId][
'am'] = 0;
307 unset ($aProducts[$sProductId]);
328 $oActView = $this->
getConfig()->getActiveView();
329 $sErrorDest = $oActView->getErrorDestination();
332 $oBasketInfo = $oBasket->getBasketSummary();
334 $basketItemAmounts = array();
336 foreach ($aProducts as $sAddProductId => $aProductInfo) {
338 $sProductId = isset($aProductInfo[
'aid']) ? $aProductInfo[
'aid'] : $sAddProductId;
341 $oProduct = $oBasketInfo->aArticles[$sProductId];
342 $aProducts[$sAddProductId][
'oldam'] = isset($oProduct) ? $oProduct : 0;
344 $dAmount = isset($aProductInfo[
'am']) ? $aProductInfo[
'am'] : 0;
345 $aSelList = isset($aProductInfo[
'sel']) ? $aProductInfo[
'sel'] : null;
346 $aParams = $aProductInfo[
'persparam'];
347 $aPersParam = (isset($aParams) && is_array($aParams) && strlen($aParams[
'details'])) ? $aParams : null;
348 $blOverride = isset($aProductInfo[
'override']) ? $aProductInfo[
'override'] : null;
349 $blIsBundle = isset($aProductInfo[
'bundle']) ?
true :
false;
350 $sOldBasketItemId = isset($aProductInfo[
'basketitemid']) ? $aProductInfo[
'basketitemid'] : null;
356 if (isset($basketItemAmounts[$sOldBasketItemId])) {
357 $dAmount = $dAmount + $basketItemAmounts[$sOldBasketItemId];
360 $oBasketItem = $oBasket->addToBasket(
370 if (is_a($oBasketItem,
'oxBasketItem')) {
371 $basketItemId = $oBasketItem->getBasketItemKey();
373 if (!empty($basketItemId)) {
374 $basketItemAmounts[$basketItemId] += $dAmount;
380 if (!$sErrorDest && $this->
getConfig()->getConfigParam(
'iNewBasketItemMessage') == 2) {
381 $sErrorDest =
'popup';
383 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false, (
bool) $sErrorDest, $sErrorDest);
387 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false, (
bool) $sErrorDest, $sErrorDest);
392 $oInfo = $oBasket->getBasketSummary();
393 $oProduct = $oInfo->aArticles[$sProductId];
394 $aProducts[$sAddProductId][
'am'] = isset($oProduct) ? $oProduct : 0;
399 if ($oBasket->getProductsCount() == 0) {
400 $oBasket->setCardId(null);
416 protected function _setLastCall($sCallName, $aProductInfo, $aBasketInfo)
428 $this->_sLastCallFnc = $sCallName;
450 if ($oBasket->showCatChangeWarning()) {
451 $oBasket->setCatChangeWarningState(
false);
459 $oActCat = oxnew(
'oxcategory');
460 if ($sActCat && $sActCat != $sDefCat && $oActCat->load($sActCat)) {
461 $sActRoot = $oActCat->oxcategories__oxrootid->value;
462 if ($oBasket->getBasketRootCatId() && $sActRoot != $oBasket->getBasketRootCatId()) {
486 $this->
getSession()->getBasket()->deleteBasket();
487 $this->
getParent()->setRootCatChanged(
false);