Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZBasket Class Reference

eZBasket handles shopping baskets More...

Inheritance diagram for eZBasket:

## Public Member Functions
| items ( $asObject=true, $sorts=array( 'contentobject_id'=> 'desc'))
| itemsOrdered ( $asObject=true, $order=true)
| itemsInfo ()
| isVATKnown ()
| totalIncVAT ()
| totalExVAT ()
| removeItem ( $itemID)
| isEmpty ()
| createOrder ()
| updatePrices ()
| type ()
| canAddProduct ( $contentObject)
| productCollection ()
Public Member Functions inherited from eZPersistentObject
| __construct ( $row=null)
| eZPersistentObject ( $row=null)
| fill ( $row)
| remove ( $conditions=null, $extraConditions=null)
| store ( $fieldFilters=null)
| sync ( $fieldFilters=null)
| attributes ()
| hasAttribute ( $attr)
| attribute ( $attr, $noFunction=false)
| setAttribute ( $attr, $val)
| hasDirtyData ()
| setHasDirtyData ( $hasDirtyData)

## Static Public Member Functions
static | definition ()
static | fetch ( $sessionKey)
static | currentBasket ( $asObject=true, $byOrderID=-1)
static | cleanupExpired ( $time)
static | cleanup ()
static | cleanupCurrentBasket ( $useSetting=true)
Static Public Member Functions inherited from eZPersistentObject
static | replaceFieldsWithShortNames (eZDBInterface $db, array $fieldDefs, &$fields)
static | count ( $def, $conds=null, $field=null)
static | fetchObject ( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
static | removeObject ( $def, $conditions=null, $extraConditions=null)
static | storeObject ( $obj, $fieldFilters=null)
static | conditionText ( $conditions)
static | conditionTextByRow ( $conditions, $row)
static | fetchObjectList ( $def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
static | handleRows ( $rows, $class_name, $asObject)
static | swapRow ( $table, $keys, $order_id, $rows, $id1, $id2)
static | newObjectOrder ( $def, $orderField, $conditions)
static | reorderObject ( $def, $orderField, $conditions, $down=true)
static | escapeArray ( $array)
static | updateObjectList ( $parameters)
static | getShortAttributeName ( $db, $def, $attrName)

## Public Attributes
| $ProductCollectionID
| $SessionID
| $OrderID
const | ITEM_LIMIT = 3000
Public Attributes inherited from eZPersistentObject
| $PersistentDataDirty
| $ID
| $ContentObjectID
| $SectionID
| $OwnerID
| $ClassID
| $Published
| $Modified
| $CurrentVersion
| $Status
| $RemoteID
| $LanguageMask
| $InitialLanguageID
| $NodeID
| $ParentNodeID
| $MainNodeID
| $ContentObjectVersion
| $ContentObjectIsPublished
| $Depth
| $SortField
| $SortOrder
| $Priority
| $ModifiedSubNode
| $PathString
| $PathIdentificationString
| $IsHidden
| $IsInvisible
| $UserID
| $Name
| $Locale
| $Identifier
| $NavigationPartIdentifier
| $SerializedDescriptionList
| $URLAliasName
| $AlwaysAvailable
| $CanTranslate
| $DataInt1
| $DataInt2
| $DataInt3
| $DataInt4
| $DataFloat1
| $DataFloat2
| $DataFloat3
| $DataFloat4
| $DataText1
| $DataText2
| $DataText3
| $DataText4
| $DataText5
| $SerializedDataText
| $Category
| $PolicyID
| $Values
| $Created
| $CurrencyCode
| $ProductCollectionID
| $ItemCount
| $Price
| $IsVATIncluded
| $VATValue
| $DiscountValue
| $Email
| $IsTemporary
| $IsArchived
| $IsActive
| $OrderID
| $ModifierID
| $Code
| $Symbol
| $AutoRateValue
| $CustomRateValue
| $RateFactor
| $Main
| $MementoKey
| $MainKey
| $WorkflowEventPos
| $LanguageID
| $ContentObjectStateGroupID
| $contentobject_attribute_id
| $contentobject_id
| $rating
| $rating_count
| $rating_average

## Additional Inherited Members
Static Protected Member Functions inherited from eZPersistentObject
static | replaceFieldsWithLongNames (eZDBInterface $db, array $fieldDefs, &$fields)

## Detailed Description

eZBasket handles shopping baskets

See also
  eZProductCollection

Definition at line 19 of file ezbasket.php.

## Member Function Documentation

## ◆ canAddProduct()

eZBasket::canAddProduct | ( |  | $contentObject | ) |

Definition at line 556 of file ezbasket.php.

References eZError\SHOP_BASKET_INCOMPATIBLE_PRODUCT_TYPE, eZError\SHOP_NOT_A_PRODUCT, eZError\SHOP_OK, and type().

## ◆ cleanup()

static eZBasket::cleanup | ( |  | ) |
| static

Removes all baskets for all users.

Note
  Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 503 of file ezbasket.php.

References eZProductCollection\cleanupList(), eZPersistentObject\count(), eZDB\instance(), and ITEM_LIMIT.

## ◆ cleanupCurrentBasket()

static eZBasket::cleanupCurrentBasket | ( |  | $useSetting = `true` | ) |
| static

Removes current basket.

Parameters

  $useSetting | - if "true" use ini setting in site.ini [ShopSettings].ClearBasketOnLogout, or just clear current basket otherwise.

Note
  Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 595 of file ezbasket.php.

References eZProductCollection\cleanupList(), currentBasket(), and eZDB\instance().

Referenced by eZUser\logoutCurrent().

## ◆ cleanupExpired()

static eZBasket::cleanupExpired | ( |  | $time | ) |
| static

Removes all baskets which are considered expired (due to session expiration).

Note
  This will also remove the product collection the basket is using.

Definition at line 445 of file ezbasket.php.

References eZProductCollection\cleanupList(), eZPersistentObject\count(), eZDB\instance(), and ITEM_LIMIT.

## ◆ createOrder()

eZBasket::createOrder | ( |  | ) |

Creates a temporary order for the current basket. The order object is returned.

Note
  Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 347 of file ezbasket.php.

References eZPersistentObject\attribute(), eZUser\currentUser(), eZDB\instance(), eZOrderStatus\PENDING, eZPersistentObject\setAttribute(), and eZPersistentObject\store().

## ◆ currentBasket()

static eZBasket::currentBasket | ( |  | $asObject = `true`,
|  |  | $byOrderID = `-1`
| ) |  |
| static

Will return the basket for the current session. If a basket does not exist one will be created.

Returns
  current eZBasket object

Note
  Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 299 of file ezbasket.php.

References eZPersistentObject\count(), eZProductCollection\create(), definition(), eZPersistentObject\fetchObjectList(), eZDB\instance(), and eZHTTPTool\instance().

Referenced by cleanupCurrentBasket().

## ◆ definition()

static eZBasket::definition | ( |  | ) |
| static

Returns
  the persistent object definition for the eZCard class.

Reimplemented from eZPersistentObject.

Definition at line 32 of file ezbasket.php.

Referenced by currentBasket(), and fetch().

## ◆ fetch()

static eZBasket::fetch | ( |  | $sessionKey | ) |
| static

Fetches the basket which belongs to session $sessionKey.

Parameters

  $sessionKey | A string containing the session key.

Returns
  An eZSessionBasket object or `false` if none was found.

Definition at line 286 of file ezbasket.php.

References definition(), and eZPersistentObject\fetchObject().

## ◆ isEmpty()

eZBasket::isEmpty | ( |  | ) |

Definition at line 275 of file ezbasket.php.

References eZPersistentObject\count(), and items().

## ◆ isVATKnown()

eZBasket::isVATKnown | ( |  | ) |

Returns true if VAT percentage is known for all basket items.

Definition at line 226 of file ezbasket.php.

References items().

## ◆ items()

eZBasket::items | ( |  | $asObject = `true`,
|  |  | $sorts = `array( 'contentobject_id' => 'desc' )`
| ) |  |

Fetch basket items (ordered by object id by default)

Parameters

  bool | $asObject |
  array | null | $sorts | Array with sort data sent directly to eZPersistentObject::fetchObjectList()

Definition at line 76 of file ezbasket.php.

References eZProductCollectionItem\definition(), and eZPersistentObject\fetchObjectList().

Referenced by isEmpty(), isVATKnown(), itemsInfo(), itemsOrdered(), totalExVAT(), totalIncVAT(), and updatePrices().

## ◆ itemsInfo()

eZBasket::itemsInfo | ( |  | ) |

Fetching calculated information about the product items.

Definition at line 155 of file ezbasket.php.

References eZPersistentObject\attribute(), items(), and eZShippingManager\updatePriceInfo().

## ◆ itemsOrdered()

eZBasket::itemsOrdered | ( |  | $asObject = `true`,
|  |  | $order = `true`
| ) |  |

Fetch basket items ordered by id ( the order they are added to basket )

Parameters

  bool | $asObject |
  bool | $order | True (default) for ascending[0->9] and false for decending[9->0]

Definition at line 147 of file ezbasket.php.

References items().

## ◆ productCollection()

eZBasket::productCollection | ( |  | ) |

Definition at line 581 of file ezbasket.php.

References eZPersistentObject\attribute(), and eZProductCollection\fetch().

## ◆ removeItem()

eZBasket::removeItem | ( |  | $itemID | ) |

Note
  Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 266 of file ezbasket.php.

References eZPersistentObject\attribute(), and eZProductCollectionItem\fetch().

## ◆ totalExVAT()

eZBasket::totalExVAT | ( |  | ) |

Definition at line 250 of file ezbasket.php.

References items().

## ◆ totalIncVAT()

eZBasket::totalIncVAT | ( |  | ) |

Definition at line 238 of file ezbasket.php.

References items().

## ◆ type()

eZBasket::type | ( |  | ) |

Returns
  the type of basket. In other words: what type of products the basket contains.

Definition at line 534 of file ezbasket.php.

References eZPersistentObject\attribute(), eZPersistentObject\count(), and eZProductCollectionItem\fetchList().

Referenced by canAddProduct().

## ◆ updatePrices()

eZBasket::updatePrices | ( |  | ) |

Note
  Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 381 of file ezbasket.php.

References eZPersistentObject\attribute(), eZDB\instance(), items(), and eZShippingManager\updateShippingInfo().

## Member Data Documentation

## ◆ $OrderID

eZBasket::$OrderID

Definition at line 23 of file ezbasket.php.

## ◆ $ProductCollectionID

eZBasket::$ProductCollectionID

Definition at line 21 of file ezbasket.php.

## ◆ $SessionID

eZBasket::$SessionID

Definition at line 22 of file ezbasket.php.

## ◆ ITEM_LIMIT

const eZBasket::ITEM_LIMIT = 3000

Controls the default value for how many items are cleaned in one batch operation.

Definition at line 27 of file ezbasket.php.

Referenced by cleanup(), and cleanupExpired().

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

- ezbasket.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.