49 if ($oConfig->getConfigParam(
'blPsBasketReservationEnabled' )) {
50 if ($oReservations = $this->
getSession()->getBasketReservations()) {
51 if (!$oReservations->getTimeLeft()) {
53 if ( $oBasket && $oBasket->getProductsCount() ) {
54 $oBasket->deleteBasket();
57 $iLimit = (int) $oConfig->getConfigParam(
'iBasketReservationCleanPerRequest' );
61 $oReservations->discardUnusedReservations($iLimit);
68 if ( $this->
getConfig()->getConfigParam(
'blBasketExcludeEnabled' ) ) {
69 if ( $oBasket = $this->
getSession()->getBasket() ) {
84 if ( $oBasket = $this->
getSession()->getBasket() ) {
85 $oBasket->calculateBasket(
false );
108 public function tobasket( $sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride =
false )
117 if ( $aProducts = $this->
_getItems( $sProductId, $dAmount, $aSel, $aPersParam, $blOverride ) ) {
120 $oBasketItem = $this->
_addItems( $aProducts );
123 if ( $oBasketItem &&
$myConfig->getConfigParam(
'iNewBasketItemMessage' ) != 0 ) {
124 $oNewItem =
new stdClass();
125 $oNewItem->sTitle = $oBasketItem->getTitle();
126 $oNewItem->sId = $oBasketItem->getProductId();
127 $oNewItem->dAmount = $oBasketItem->getAmount();
128 $oNewItem->dBundledAmount = $oBasketItem->getdBundledAmount();
151 public function changebasket( $sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride =
true )
162 if ( $sBasketItemId ) {
165 $aBasketContents = $oBasket->getContents();
166 $sProductId = isset( $aBasketContents[$sBasketItemId] )?$aBasketContents[$sBasketItemId]->getProductId():null;
178 if ( $aProducts = $this->
_getItems( $sProductId, $dAmount, $aSel, $aPersParam, $blOverride ) ) {
182 $oBasket->onUpdate();
185 $oBasketItem = $this->
_addItems( $aProducts );
201 $sClass = $sClass?$sClass.
'?':
'start?';
205 foreach ( $this->aRedirectParams as $sParamName ) {
207 $sPosition .= $sParamVal?$sParamName.
'='.$sParamVal.
'&':
'';
213 $sPosition .= $sParam?
'searchparam='.$sParam.
'&':
'';
217 $sPosition .= ( $iPageNr > 0 )?
'pgNr='.$iPageNr.
'&':
'';
220 if ( $this->
getConfig()->getConfigParam(
'iNewBasketItemMessage' ) == 3 ) {
229 return $sClass.$sPosition;
244 protected function _getItems( $sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride =
false )
260 if ( empty($aPersParam) ) {
262 if ( !is_array($aPersParam) || empty($aPersParam[
'details']) ) {
269 $aProducts[$sProductId] = array(
'am' => $dAmount,
271 'persparam' => $aPersParam,
272 'override' => $blOverride,
273 'basketitemid' => $sBasketItemId
277 if ( is_array( $aProducts ) && count( $aProducts ) ) {
281 foreach ( $aProducts as $sProductId => $aProduct ) {
282 if ( isset($aProduct[
'remove']) && $aProduct[
'remove']) {
283 $aProducts[$sProductId][
'am'] = 0;
285 unset ($aProducts[$sProductId]);
306 $oActView = $this->
getConfig()->getActiveView();
307 $sErrorDest = $oActView->getErrorDestination();
310 $oBasketInfo = $oBasket->getBasketSummary();
312 foreach ( $aProducts as $sAddProductId => $aProductInfo ) {
314 $sProductId = isset( $aProductInfo[
'aid'] ) ? $aProductInfo[
'aid'] : $sAddProductId;
317 $aProducts[$sAddProductId][
'oldam'] = isset( $oBasketInfo->aArticles[$sProductId] ) ? $oBasketInfo->aArticles[$sProductId] : 0;
319 $dAmount = isset( $aProductInfo[
'am'] )?$aProductInfo[
'am']:0;
320 $aSelList = isset( $aProductInfo[
'sel'] )?$aProductInfo[
'sel']:null;
321 $aPersParam = ( isset( $aProductInfo[
'persparam'] ) && is_array( $aProductInfo[
'persparam'] ) && strlen( $aProductInfo[
'persparam'][
'details'] ) )?$aProductInfo[
'persparam']:null;
322 $blOverride = isset( $aProductInfo[
'override'] )?$aProductInfo[
'override']:null;
323 $blIsBundle = isset( $aProductInfo[
'bundle'] )?
true:
false;
324 $sOldBasketItemId = isset( $aProductInfo[
'basketitemid'] )?$aProductInfo[
'basketitemid']:null;
327 $oBasketItem = $oBasket->addToBasket( $sProductId, $dAmount, $aSelList, $aPersParam, $blOverride, $blIsBundle, $sOldBasketItemId );
331 if ( !$sErrorDest && $this->
getConfig()->getConfigParam(
'iNewBasketItemMessage') == 2) {
332 $sErrorDest =
'popup';
334 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay( $oEx,
false, (
bool) $sErrorDest, $sErrorDest );
338 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay( $oEx,
false, (
bool) $sErrorDest, $sErrorDest );
342 if ( !$oBasketItem ) {
343 $oInfo = $oBasket->getBasketSummary();
344 $aProducts[$sAddProductId][
'am'] = isset( $oInfo->aArticles[$sProductId] ) ? $oInfo->aArticles[$sProductId] : 0;
349 if ( $oBasket->getProductsCount() == 0 ) {
350 $oBasket->setCardId( null );
368 protected function _setLastCall( $sCallName, $aProductInfo, $aBasketInfo )
382 $this->_sLastCallFnc = $sCallName;
404 if ( $oBasket->showCatChangeWarning() ) {
405 $oBasket->setCatChangeWarningState(
false );
412 $oActCat = oxnew(
'oxcategory');
413 if ($sActCat && $sActCat!=$sDefCat && $oActCat->load($sActCat) ) {
414 $sActRoot = $oActCat->oxcategories__oxrootid->value;
415 if ( $oBasket->getBasketRootCatId() && $sActRoot != $oBasket->getBasketRootCatId() ) {
439 $this->
getSession()->getBasket()->deleteBasket();
440 $this->
getParent()->setRootCatChanged(
false );