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();
173 if ($sBasketItemId) {
176 $aBasketContents = $oBasket->getContents();
177 $oItem = $aBasketContents[$sBasketItemId];
179 $sProductId = isset($oItem) ? $oItem->getProductId() : null;
191 if ($aProducts = $this->
_getItems($sProductId, $dAmount, $aSel, $aPersParam, $blOverride)) {
195 $oBasket->onUpdate();
198 $oBasketItem = $this->
_addItems($aProducts);
214 $sClass = $sClass ? $sClass .
'?' :
'start?';
218 foreach ($this->aRedirectParams as $sParamName) {
220 $sPosition .= $sParamVal ? $sParamName .
'=' . $sParamVal .
'&' :
'';
226 $sPosition .= $sParam ?
'searchparam=' . $sParam .
'&' :
'';
230 $sPosition .= ($iPageNr > 0) ?
'pgNr=' . $iPageNr .
'&' :
'';
233 if ($this->
getConfig()->getConfigParam(
'iNewBasketItemMessage') == 3) {
242 return $sClass . $sPosition;
278 if (empty($aPersParam)) {
280 if (!is_array($aPersParam) || empty($aPersParam[
'details'])) {
287 $aProducts[$sProductId] = array(
'am' => $dAmount,
289 'persparam' => $aPersParam,
290 'override' => $blOverride,
291 'basketitemid' => $sBasketItemId
295 if (is_array($aProducts) && count($aProducts)) {
299 foreach ($aProducts as $sProductId => $aProduct) {
300 if (isset($aProduct[
'remove']) && $aProduct[
'remove']) {
301 $aProducts[$sProductId][
'am'] = 0;
303 unset ($aProducts[$sProductId]);
324 $oActView = $this->
getConfig()->getActiveView();
325 $sErrorDest = $oActView->getErrorDestination();
328 $oBasketInfo = $oBasket->getBasketSummary();
330 $basketItemAmounts = array();
332 foreach ($aProducts as $sAddProductId => $aProductInfo) {
334 $sProductId = isset($aProductInfo[
'aid']) ? $aProductInfo[
'aid'] : $sAddProductId;
337 $oProduct = $oBasketInfo->aArticles[$sProductId];
338 $aProducts[$sAddProductId][
'oldam'] = isset($oProduct) ? $oProduct : 0;
340 $dAmount = isset($aProductInfo[
'am']) ? $aProductInfo[
'am'] : 0;
341 $aSelList = isset($aProductInfo[
'sel']) ? $aProductInfo[
'sel'] : null;
342 $aParams = $aProductInfo[
'persparam'];
343 $aPersParam = (isset($aParams) && is_array($aParams) && strlen($aParams[
'details'])) ? $aParams : null;
344 $blOverride = isset($aProductInfo[
'override']) ? $aProductInfo[
'override'] : null;
345 $blIsBundle = isset($aProductInfo[
'bundle']) ?
true :
false;
346 $sOldBasketItemId = isset($aProductInfo[
'basketitemid']) ? $aProductInfo[
'basketitemid'] : null;
352 if (isset($basketItemAmounts[$sOldBasketItemId])) {
353 $dAmount = $dAmount + $basketItemAmounts[$sOldBasketItemId];
356 $oBasketItem = $oBasket->addToBasket(
366 if (is_a($oBasketItem,
'oxBasketItem')) {
367 $basketItemId = $oBasketItem->getBasketItemKey();
369 if (!empty($basketItemId)) {
370 $basketItemAmounts[$basketItemId] += $dAmount;
376 if (!$sErrorDest && $this->
getConfig()->getConfigParam(
'iNewBasketItemMessage') == 2) {
377 $sErrorDest =
'popup';
379 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false, (
bool) $sErrorDest, $sErrorDest);
383 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false, (
bool) $sErrorDest, $sErrorDest);
388 $oInfo = $oBasket->getBasketSummary();
389 $oProduct = $oInfo->aArticles[$sProductId];
390 $aProducts[$sAddProductId][
'am'] = isset($oProduct) ? $oProduct : 0;
395 if ($oBasket->getProductsCount() == 0) {
396 $oBasket->setCardId(null);
412 protected function _setLastCall($sCallName, $aProductInfo, $aBasketInfo)
424 $this->_sLastCallFnc = $sCallName;
446 if ($oBasket->showCatChangeWarning()) {
447 $oBasket->setCatChangeWarningState(
false);
455 $oActCat = oxnew(
'oxcategory');
456 if ($sActCat && $sActCat != $sDefCat && $oActCat->load($sActCat)) {
457 $sActRoot = $oActCat->oxcategories__oxrootid->value;
458 if ($oBasket->getBasketRootCatId() && $sActRoot != $oBasket->getBasketRootCatId()) {
482 $this->
getSession()->getBasket()->deleteBasket();
483 $this->
getParent()->setRootCatChanged(
false);