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 foreach ($aProducts as $sAddProductId => $aProductInfo) {
328 $sProductId = isset($aProductInfo[
'aid']) ? $aProductInfo[
'aid'] : $sAddProductId;
331 $oProduct = $oBasketInfo->aArticles[$sProductId];
332 $aProducts[$sAddProductId][
'oldam'] = isset($oProduct) ? $oProduct : 0;
334 $dAmount = isset($aProductInfo[
'am']) ? $aProductInfo[
'am'] : 0;
335 $aSelList = isset($aProductInfo[
'sel']) ? $aProductInfo[
'sel'] : null;
336 $aParams = $aProductInfo[
'persparam'];
337 $aPersParam = (isset($aParams) && is_array($aParams) && strlen($aParams[
'details'])) ? $aParams : null;
338 $blOverride = isset($aProductInfo[
'override']) ? $aProductInfo[
'override'] : null;
339 $blIsBundle = isset($aProductInfo[
'bundle']) ?
true :
false;
340 $sOldBasketItemId = isset($aProductInfo[
'basketitemid']) ? $aProductInfo[
'basketitemid'] : null;
343 $oBasketItem = $oBasket->addToBasket(
355 if (!$sErrorDest && $this->
getConfig()->getConfigParam(
'iNewBasketItemMessage') == 2) {
356 $sErrorDest =
'popup';
358 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false, (
bool) $sErrorDest, $sErrorDest);
362 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false, (
bool) $sErrorDest, $sErrorDest);
367 $oInfo = $oBasket->getBasketSummary();
368 $oProduct = $oInfo->aArticles[$sProductId];
369 $aProducts[$sAddProductId][
'am'] = isset($oProduct) ? $oProduct : 0;
374 if ($oBasket->getProductsCount() == 0) {
375 $oBasket->setCardId(null);
391 protected function _setLastCall($sCallName, $aProductInfo, $aBasketInfo)
403 $this->_sLastCallFnc = $sCallName;
425 if ($oBasket->showCatChangeWarning()) {
426 $oBasket->setCatChangeWarningState(
false);
434 $oActCat = oxnew(
'oxcategory');
435 if ($sActCat && $sActCat != $sDefCat && $oActCat->load($sActCat)) {
436 $sActRoot = $oActCat->oxcategories__oxrootid->value;
437 if ($oBasket->getBasketRootCatId() && $sActRoot != $oBasket->getBasketRootCatId()) {
461 $this->
getSession()->getBasket()->deleteBasket();
462 $this->
getParent()->setRootCatChanged(
false);