51 if ($oConfig->getConfigParam(
'blPsBasketReservationEnabled')) {
52 if ($oReservations = $this->
getSession()->getBasketReservations()) {
53 if (!$oReservations->getTimeLeft()) {
55 if ($oBasket && $oBasket->getProductsCount()) {
56 $oBasket->deleteBasket();
59 $iLimit = (int) $oConfig->getConfigParam(
'iBasketReservationCleanPerRequest');
63 $oReservations->discardUnusedReservations($iLimit);
70 if ($this->
getConfig()->getConfigParam(
'blBasketExcludeEnabled')) {
71 if ($oBasket = $this->
getSession()->getBasket()) {
86 if ($oBasket = $this->
getSession()->getBasket()) {
87 $oBasket->calculateBasket(
false);
110 public function tobasket($sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride =
false)
119 if ($aProducts = $this->
_getItems($sProductId, $dAmount, $aSel, $aPersParam, $blOverride)) {
122 $oBasketItem = $this->
_addItems($aProducts);
125 if ($oBasketItem &&
$myConfig->getConfigParam(
'iNewBasketItemMessage') != 0) {
126 $oNewItem =
new stdClass();
127 $oNewItem->sTitle = $oBasketItem->getTitle();
128 $oNewItem->sId = $oBasketItem->getProductId();
129 $oNewItem->dAmount = $oBasketItem->getAmount();
130 $oNewItem->dBundledAmount = $oBasketItem->getdBundledAmount();
169 if ($sBasketItemId) {
172 $aBasketContents = $oBasket->getContents();
173 $oItem = $aBasketContents[$sBasketItemId];
175 $sProductId = isset($oItem) ? $oItem->getProductId() : null;
187 if ($aProducts = $this->
_getItems($sProductId, $dAmount, $aSel, $aPersParam, $blOverride)) {
191 $oBasket->onUpdate();
194 $oBasketItem = $this->
_addItems($aProducts);
210 $sClass = $sClass ? $sClass .
'?' :
'start?';
214 foreach ($this->aRedirectParams as $sParamName) {
216 $sPosition .= $sParamVal ? $sParamName .
'=' . $sParamVal .
'&' :
'';
222 $sPosition .= $sParam ?
'searchparam=' . $sParam .
'&' :
'';
226 $sPosition .= ($iPageNr > 0) ?
'pgNr=' . $iPageNr .
'&' :
'';
229 if ($this->
getConfig()->getConfigParam(
'iNewBasketItemMessage') == 3) {
238 return $sClass . $sPosition;
274 if (empty($aPersParam)) {
276 if (!is_array($aPersParam) || empty($aPersParam[
'details'])) {
283 $aProducts[$sProductId] = array(
'am' => $dAmount,
285 'persparam' => $aPersParam,
286 'override' => $blOverride,
287 'basketitemid' => $sBasketItemId
291 if (is_array($aProducts) && count($aProducts)) {
295 foreach ($aProducts as $sProductId => $aProduct) {
296 if (isset($aProduct[
'remove']) && $aProduct[
'remove']) {
297 $aProducts[$sProductId][
'am'] = 0;
299 unset ($aProducts[$sProductId]);
320 $oActView = $this->
getConfig()->getActiveView();
321 $sErrorDest = $oActView->getErrorDestination();
324 $oBasketInfo = $oBasket->getBasketSummary();
326 $basketItemAmounts = array();
328 foreach ($aProducts as $sAddProductId => $aProductInfo) {
330 $sProductId = isset($aProductInfo[
'aid']) ? $aProductInfo[
'aid'] : $sAddProductId;
333 $oProduct = $oBasketInfo->aArticles[$sProductId];
334 $aProducts[$sAddProductId][
'oldam'] = isset($oProduct) ? $oProduct : 0;
336 $dAmount = isset($aProductInfo[
'am']) ? $aProductInfo[
'am'] : 0;
337 $aSelList = isset($aProductInfo[
'sel']) ? $aProductInfo[
'sel'] : null;
338 $aParams = $aProductInfo[
'persparam'];
339 $aPersParam = (isset($aParams) && is_array($aParams) && strlen($aParams[
'details'])) ? $aParams : null;
340 $blOverride = isset($aProductInfo[
'override']) ? $aProductInfo[
'override'] : null;
341 $blIsBundle = isset($aProductInfo[
'bundle']) ?
true :
false;
342 $sOldBasketItemId = isset($aProductInfo[
'basketitemid']) ? $aProductInfo[
'basketitemid'] : null;
348 if (isset($basketItemAmounts[$sOldBasketItemId])) {
349 $dAmount = $dAmount + $basketItemAmounts[$sOldBasketItemId];
352 $oBasketItem = $oBasket->addToBasket(
362 if (is_a($oBasketItem,
'oxBasketItem')) {
363 $basketItemId = $oBasketItem->getBasketItemKey();
365 if (!empty($basketItemId)) {
366 $basketItemAmounts[$basketItemId] += $dAmount;
372 if (!$sErrorDest && $this->
getConfig()->getConfigParam(
'iNewBasketItemMessage') == 2) {
373 $sErrorDest =
'popup';
375 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false, (
bool) $sErrorDest, $sErrorDest);
379 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false, (
bool) $sErrorDest, $sErrorDest);
384 $oInfo = $oBasket->getBasketSummary();
385 $oProduct = $oInfo->aArticles[$sProductId];
386 $aProducts[$sAddProductId][
'am'] = isset($oProduct) ? $oProduct : 0;
391 if ($oBasket->getProductsCount() == 0) {
392 $oBasket->setCardId(null);
408 protected function _setLastCall($sCallName, $aProductInfo, $aBasketInfo)
420 $this->_sLastCallFnc = $sCallName;
442 if ($oBasket->showCatChangeWarning()) {
443 $oBasket->setCatChangeWarningState(
false);
451 $oActCat = oxnew(
'oxcategory');
452 if ($sActCat && $sActCat != $sDefCat && $oActCat->load($sActCat)) {
453 $sActRoot = $oActCat->oxcategories__oxrootid->value;
454 if ($oBasket->getBasketRootCatId() && $sActRoot != $oBasket->getBasketRootCatId()) {
478 $this->
getSession()->getBasket()->deleteBasket();
479 $this->
getParent()->setRootCatChanged(
false);