OXID eShop CE  6.1.5
OxidEsales\EshopCommunity\Application\Model\UserBasket Class Reference
+ Inheritance diagram for OxidEsales\EshopCommunity\Application\Model\UserBasket:
+ Collaboration diagram for OxidEsales\EshopCommunity\Application\Model\UserBasket:

Public Member Functions

 __construct ()
 
 setIsNewBasket ()
 
 isNewBasket ()
 
 isEmpty ()
 
 getArticles ()
 
 getItems ($blReload=false, $blActiveCheck=true)
 
 getItem ($sProductId, $aSelList, $aPersParams=null)
 
 getItemCount ($blReload=false)
 
 addItemToBasket ($sProductId=null, $dAmount=null, $aSel=null, $blOverride=false, $aPersParam=null)
 
 delete ($sOXID=null)
 
 isVisible ()
 

Protected Member Functions

 _insert ()
 
 _createItem ($sProductId, $aSelList=null, $aPersParams=null)
 
 _getItemKey ($sProductId, $aSel=null, $aPersParam=null)
 

Protected Attributes

 $_aSkipSaveFields = ['oxcreate', 'oxtimestamp']
 
 $_sClassName = 'oxUserbasket'
 
 $_aBasketItems = null
 
 $_blNewBasket = false
 

Detailed Description

Virtual basket manager class. Virtual baskets are user article lists which are stored in database (noticelists, wishlists). The name of the class is left like this because of historic reasons. It is more relevant to wishlist and noticelist than to shoping basket. Collects shopping basket information, updates it (DB level), removes or adds articles to it.

Constructor & Destructor Documentation

◆ __construct()

OxidEsales\EshopCommunity\Application\Model\UserBasket::__construct ( )

Class constructor, initiates parent constructor (parent::oxBase()).

Member Function Documentation

◆ _createItem()

OxidEsales\EshopCommunity\Application\Model\UserBasket::_createItem (   $sProductId,
  $aSelList = null,
  $aPersParams = null 
)
protected

Creates and returns oxuserbasketitem object

Parameters
string$sProductIdProduct Id
array$aSelListproduct select lists
string$aPersParamspersistent parameters
Returns
oxUserBasketItem

◆ _getItemKey()

OxidEsales\EshopCommunity\Application\Model\UserBasket::_getItemKey (   $sProductId,
  $aSel = null,
  $aPersParam = null 
)
protected

Returns unique item key according to its ID and user chosen select

Parameters
string$sProductIdProduct Id
array$aSelproduct select lists
array$aPersParambasket item persistent parameters
Returns
string

◆ _insert()

OxidEsales\EshopCommunity\Application\Model\UserBasket::_insert ( )
protected

Inserts object data to DB, returns true on success.

Returns
mixed

◆ addItemToBasket()

OxidEsales\EshopCommunity\Application\Model\UserBasket::addItemToBasket (   $sProductId = null,
  $dAmount = null,
  $aSel = null,
  $blOverride = false,
  $aPersParam = null 
)

Method adds/removes user chosen article to/from his noticelist or wishlist. Returns total amount of articles in list.

Parameters
string$sProductIdArticle ID
double$dAmountProduct amount
array$aSelproduct select lists
bool$blOverrideif true overrides $dAmount, else sums previous with current it
array$aPersParamproduct persistent parameters (default null)
Returns
integer

◆ delete()

OxidEsales\EshopCommunity\Application\Model\UserBasket::delete (   $sOXID = null)

Deletes current basket history

Parameters
string$sOXIDObject ID(default null)
Returns
bool

◆ getArticles()

OxidEsales\EshopCommunity\Application\Model\UserBasket::getArticles ( )

Returns an array of articles belonging to the Items in the basket

Returns
array of oxArticle

◆ getItem()

OxidEsales\EshopCommunity\Application\Model\UserBasket::getItem (   $sProductId,
  $aSelList,
  $aPersParams = null 
)

Searches for item in basket items array and returns it. If not item was found - new item is created.

Parameters
string$sProductIdproduct id, basket item id or basket item index
array$aSelListselect lists
string$aPersParamspersistent parameters
Returns
oxUserBasketItem

◆ getItemCount()

OxidEsales\EshopCommunity\Application\Model\UserBasket::getItemCount (   $blReload = false)

Returns current basket item count

Parameters
bool$blReloadif TRUE forces to reload list
Returns
int

◆ getItems()

OxidEsales\EshopCommunity\Application\Model\UserBasket::getItems (   $blReload = false,
  $blActiveCheck = true 
)

Returns list of basket items

Parameters
bool$blReloadif TRUE forces to reload list
bool$blActiveCheckshould articles be checked for active state?
Returns
array of oxUserBasketItems

◆ isEmpty()

OxidEsales\EshopCommunity\Application\Model\UserBasket::isEmpty ( )

Checks if user basket is empty

Returns
bool

◆ isNewBasket()

OxidEsales\EshopCommunity\Application\Model\UserBasket::isNewBasket ( )

Checks if user basket is newly created

Returns
bool

◆ isVisible()

OxidEsales\EshopCommunity\Application\Model\UserBasket::isVisible ( )

Checks if user basket is visible for current user (public or own basket)

Returns
bool

◆ setIsNewBasket()

OxidEsales\EshopCommunity\Application\Model\UserBasket::setIsNewBasket ( )

Sets basket as newly created. This usually means that it is not yet stored in DB and will only be stored if some item is added

Member Data Documentation

◆ $_aBasketItems

OxidEsales\EshopCommunity\Application\Model\UserBasket::$_aBasketItems = null
protected

◆ $_aSkipSaveFields

OxidEsales\EshopCommunity\Application\Model\UserBasket::$_aSkipSaveFields = ['oxcreate', 'oxtimestamp']
protected

◆ $_blNewBasket

OxidEsales\EshopCommunity\Application\Model\UserBasket::$_blNewBasket = false
protected

◆ $_sClassName

OxidEsales\EshopCommunity\Application\Model\UserBasket::$_sClassName = 'oxUserbasket'
protected

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