OXID eShop CE  6.4.2
OxidEsales\EshopCommunity\Application\Component\BasketComponent Class Reference
+ Inheritance diagram for OxidEsales\EshopCommunity\Application\Component\BasketComponent:
+ Collaboration diagram for OxidEsales\EshopCommunity\Application\Component\BasketComponent:

Public Member Functions

 init ()
 
 render ()
 
 toBasket ($sProductId=null, $dAmount=null, $aSel=null, $aPersParam=null, $blOverride=false)
 
 changeBasket ( $sProductId=null, $dAmount=null, $aSel=null, $aPersParam=null, $blOverride=true)
 
 isRootCatChanged ()
 
 executeUserChoice ()
 

Public Attributes

 $aRedirectParams
 

Protected Member Functions

 _getRedirectUrl ()
 
 getPersistedParameters ($persistedParameters=null)
 
 _getItems ($sProductId=null, $dAmount=null, $aSel=null, $aPersParam=null, $blOverride=false)
 
 _addItems ($products)
 
 _setLastCall ($sCallName, $aProductInfo, $aBasketInfo)
 
 _setLastCallFnc ($sCallName)
 
 _getLastCallFnc ()
 
 emptyBasket ($oBasket)
 
 prepareProductInformation ($addProductId, $productInfo)
 
 addItemToBasket ($basket, $itemData, $errorDestination)
 

Protected Attributes

 $_blIsComponent = true
 
 $_sLastCallFnc = null
 

Detailed Description

Main shopping basket manager. Arranges shopping basket contents, updates amounts, prices, taxes etc.

@subpackage oxcmp

Member Function Documentation

◆ _addItems()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::_addItems (   $products)
protected

Adds all articles user wants to add to basket. Returns last added to basket item.

Parameters
array$productsproducts to add array
Returns
object $oBasketItem last added basket item
Deprecated:
underscore prefix violates PSR12, will be renamed to "addItems" in next major

◆ _getItems()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::_getItems (   $sProductId = null,
  $dAmount = null,
  $aSel = null,
  $aPersParam = null,
  $blOverride = false 
)
protected

Collects and returns array of items to add to basket. Product info is taken not only from given parameters, but additionally from request 'aproducts' parameter

Parameters
string$sProductIdproduct ID
double$dAmountproduct amount
array$aSelproduct select lists
array$aPersParamproduct persistent parameters
bool$blOverrideamount override status
Returns
mixed
Deprecated:
underscore prefix violates PSR12, will be renamed to "getItems" in next major

◆ _getLastCallFnc()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::_getLastCallFnc ( )
protected

Getting last call function name (data used by econda)

Returns
string
Deprecated:
underscore prefix violates PSR12, will be renamed to "getLastCallFnc" in next major

◆ _getRedirectUrl()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::_getRedirectUrl ( )
protected

Formats and returns redirect URL where shop must be redirected after storing something to basket

Returns
string $sClass.$sPosition redirection URL
Deprecated:
underscore prefix violates PSR12, will be renamed to "getRedirectUrl" in next major

◆ _setLastCall()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::_setLastCall (   $sCallName,
  $aProductInfo,
  $aBasketInfo 
)
protected

Setting last call data to session (data used by econda)

Parameters
string$sCallNamename of action ('tobasket', 'changebasket')
array$aProductInfodata which comes from request when you press button "to basket"
array$aBasketInfoarray returned by \OxidEsales\Eshop\Application\Model\Basket::getBasketSummary()
Deprecated:
underscore prefix violates PSR12, will be renamed to "setLastCall" in next major

◆ _setLastCallFnc()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::_setLastCallFnc (   $sCallName)
protected

Setting last call function name (data used by econda)

Parameters
string$sCallNamename of action ('tobasket', 'changebasket')
Deprecated:
underscore prefix violates PSR12, will be renamed to "setLastCallFnc" in next major

◆ addItemToBasket()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::addItemToBasket (   $basket,
  $itemData,
  $errorDestination 
)
protected

Add one item to basket. Handle eventual errors.

Parameters
\OxidEsales\Eshop\Application\Model\Basket$basket
array$itemData
string$errorDestination
Returns
null|oxBasketItem

◆ changeBasket()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::changeBasket (   $sProductId = null,
  $dAmount = null,
  $aSel = null,
  $aPersParam = null,
  $blOverride = true 
)

Similar to tobasket, except that as product id "bindex" parameter is (can be) taken

Parameters
string$sProductIdProduct ID (default null)
double$dAmountProduct amount (default null)
array$aSel(default null)
array$aPersParam(default null)
bool$blOverrideIf true means increase amount of chosen article (default false)
Returns
mixed

◆ emptyBasket()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::emptyBasket (   $oBasket)
protected

Deletes user basket object from session and saved one from DB if needed.

Parameters
\OxidEsales\Eshop\Application\Model\Basket$oBasket

◆ executeUserChoice()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::executeUserChoice ( )

Executes user choice:

  • if user clicked on "Proceed to checkout" - redirects to basket,
  • if clicked "Continue shopping" - clear basket
Returns
mixed

◆ getPersistedParameters()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::getPersistedParameters (   $persistedParameters = null)
protected

Cleans and returns persisted parameters.

Parameters
array$persistedParameterskey-value parameters (optional). If not passed - takes parameters from request.
Returns
array|null cleaned up parameters or null, if there are no non-empty parameters

◆ init()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::init ( )

Initiates component.

◆ isRootCatChanged()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::isRootCatChanged ( )

Returns true if active root category was changed

Returns
bool

◆ prepareProductInformation()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::prepareProductInformation (   $addProductId,
  $productInfo 
)
protected

Prepare information for adding product to basket.

Parameters
string$addProductId
array$productInfo
Returns
array

◆ render()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::render ( )

Loads basket ($oBasket = $mySession->getBasket()), calls oBasket->calculateBasket, executes parent::render() and returns basket object.

Returns
object $oBasket basket object

◆ toBasket()

OxidEsales\EshopCommunity\Application\Component\BasketComponent::toBasket (   $sProductId = null,
  $dAmount = null,
  $aSel = null,
  $aPersParam = null,
  $blOverride = false 
)

Basket content update controller. Before adding article - check if client is not a search engine. If yes - exits method by returning false. If no - executes oxcmp_basket::_addItems() and puts article to basket. Returns position where to redirect user browser.

Parameters
string$sProductIdProduct ID (default null)
double$dAmountProduct amount (default null)
array$aSel(default null)
array$aPersParam(default null)
bool$blOverrideIf true amount in basket is replaced by $dAmount otherwise amount is increased by $dAmount (default false)
Returns
mixed
Exceptions

Member Data Documentation

◆ $_blIsComponent

OxidEsales\EshopCommunity\Application\Component\BasketComponent::$_blIsComponent = true
protected

◆ $_sLastCallFnc

OxidEsales\EshopCommunity\Application\Component\BasketComponent::$_sLastCallFnc = null
protected

◆ $aRedirectParams

OxidEsales\EshopCommunity\Application\Component\BasketComponent::$aRedirectParams
Initial value:
= ['cnid',
'mnid',
'anid',
'tpl',
'listtype',
'searchcnid',
'searchvendor',
'searchmanufacturer',
'searchrecomm',
'recommid'
]

The documentation for this class was generated from the following file: