eZ Publish  [trunk]
eZOrder Class Reference

eZOrder handles orders More...

+ Inheritance diagram for eZOrder:
+ Collaboration diagram for eZOrder:

List of all members.

Public Member Functions

 accountEmail ()
 accountInformation ()
 accountName ()
 accountViewTemplate ()
 activate ()
 canModifyStatus ($statusID, $user=false)
 createStatusHistory ()
 currencyCode ($collection=false)
 detachProductCollection ()
 eZOrder ($row)
 getNewID ()
 Get a new auto_increment id from a separate table ezorder_nr_incr.
 modifyStatus ($statusID, $userID=false)
 orderInfo ()
 orderItems ()
 orderItemsByType ($itemType)
 orderTotalExVAT ()
 orderTotalIncVAT ()
 productCollection ()
 productItems ($asObject=true, array $sorts=null)
 Fetch product items that bellongs ot the order.
 productItemsOrdered ($asObject=true, $order=true)
 Fetch product items ordered by id ( the order they where added to order )
 productTotalExVAT ()
 productTotalIncVAT ()
 purge ($removeCollection=true)
 removeCollection ()
 removeHistory ()
 removeOrderItems ()
 setStatus ($status)
 setStatusModified ($timestamp)
 status ($asObject=false)
 statusModificationList ($user=false)
 statusName ()
 statusObject ()
 totalExVAT ()
 totalIncVAT ()
 totalVAT ()
 user ()

Static Public Member Functions

static active ($asObject=true, $offset, $limit, $sortField="created", $sortOrder="asc", $show=eZOrder::SHOW_NORMAL)
static activeByUserID ($userID, $asObject=true)
static activeCount ($show=eZOrder::SHOW_NORMAL)
static archiveOrder ($orderID)
static cleanup ()
static cleanupOrder ($orderID)
static customerCount ()
static customerList ($offset, $limit)
static definition ()
 Returns the definition for the object, the default implementation is to return an empty array.
static discount ($userID, $object)
static fetch ($id, $asObject=true)
static fetchList ($asObject=true)
static fetchLocaleCurrencyCode ()
static getShowOrdersQuery ($show, $table=null)
static orderList ($CustomID, $Email)
static orderStatistics ($year=false, $month=false)
static productList ($CustomID, $Email)
static removeItem ($itemID)
static unArchiveOrder ($orderID)

Public Attributes

 $Status
 The cached status object or null if not cached yet.
const SHOW_ALL = 2
const SHOW_ARCHIVED = 1
const SHOW_NORMAL = 0

Detailed Description

eZOrder handles orders

See also:
eZProductCollection eZBasket

Definition at line 19 of file ezorder.php.


Member Function Documentation

Returns:
the account email The shop account handler decides what is returned here

Definition at line 1019 of file ezorder.php.

Returns:
the account information The shop account handler decides what is returned here

Definition at line 995 of file ezorder.php.

Returns:
the custom name The shop account handler decides what is returned here

Definition at line 1007 of file ezorder.php.

Returns:
the template to use for account view

Definition at line 1327 of file ezorder.php.

Creates a real order from the temporary state.

The ezorder has an internal (id) and an external (order_nr) ID. The ID will be set as soon as a customer (who buys a product), approves the account information. A row is added to the ezorder table (the ID (auto_increment) is generated). This ID is needed for extensions, such as PaynetTerminal (The ID is given.)

The active (confirmed and paid) orders have an order_nr. This order_nr is generated as soon as the order is processed.

We use order_nr instead of the id to (externally) rever to an order:

  • We don't have gaps in the order_nr's.
  • The lowest order_nr goes to the order which is accepted first. (Not started first.)

Another solution would be to use an temporary_order table, instead of adding two IDs. I think (rb) this is a cleaner solution.

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 1289 of file ezorder.php.

static eZOrder::active ( asObject = true,
offset,
limit,
sortField = "created",
sortOrder = "asc",
show = eZOrder::SHOW_NORMAL 
) [static]
Returns:
the active orders

Definition at line 213 of file ezorder.php.

static eZOrder::activeByUserID ( userID,
asObject = true 
) [static]

Definition at line 186 of file ezorder.php.

static eZOrder::activeCount ( show = eZOrder::SHOW_NORMAL) [static]
Returns:
the number of active orders

Definition at line 269 of file ezorder.php.

static eZOrder::archiveOrder ( orderID) [static]

Archive an order.

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 1367 of file ezorder.php.

eZOrder::canModifyStatus ( statusID,
user = false 
)
Returns:
true if the user $user can modify the status to $statusID

Definition at line 1041 of file ezorder.php.

static eZOrder::cleanup ( ) [static]

Removes all orders from the database.

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 1393 of file ezorder.php.

static eZOrder::cleanupOrder ( orderID) [static]

Removes an order and its related data from the database.

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 1338 of file ezorder.php.

Creates a status history element from the the current status information and stores it in the database.

Returns:
The new history element that was stored in the database.
Note:
This is usually only needed the first time an order is created.
transaction unsafe

Definition at line 1208 of file ezorder.php.

Referenced by activate().

eZOrder::currencyCode ( collection = false)
Returns:
the used currency code for the order. Will return the locale currency if only a emty string is found from the order.
Parameters:
$collectionmay contain:
  • A string with the currency code.
  • An object of the class eZProductCollection.
  • false, to fetch the current productCollection from the order.

Definition at line 1545 of file ezorder.php.

static eZOrder::customerCount ( ) [static]
Returns:
number of customers.

Definition at line 577 of file ezorder.php.

static eZOrder::customerList ( offset,
limit 
) [static]
Returns:
the list customers.

Definition at line 587 of file ezorder.php.

static eZOrder::definition ( ) [static]

Returns the definition for the object, the default implementation is to return an empty array.

It's upto each inheriting class to return a proper definition array.

The definition array is an associative array consists of these keys:

  • fields: an associative array of fields which defines which database field (the key) is to fetched and how they map to object member variables (the value).
  • keys: an array of fields which is used for uniquely identifying the object in the table.
  • function_attributes: an associative array of attributes which maps to member functions, used for fetching data with functions.
  • set_functions: an associative array of attributes which maps to member functions, used for setting data with functions.
  • increment_key: the field which is incremented on table inserts.
  • class_name: the classname which is used for instantiating new objecs when fetching from the database.
  • sort: an associative array which defines the default sorting of lists, the key is the table field while the value is the sorting method which is either 'asc' or 'desc'.
  • name: the name of the database table

Example: public static function definition() { return array( "fields" => array( "id" => "ID", "version" => "Version", "name" => "Name" ), "keys" => array( "id", "version" ), "function_attributes" => array( "current" => "currentVersion", "class_name" => "className" ), "increment_key" => "id", "class_name" => "eZContentClass", "sort" => array( "id" => "asc" ), "name" => "ezcontentclass" ); }

Returns:
array

Reimplemented from eZPersistentObject.

Definition at line 31 of file ezorder.php.

Referenced by active(), activeByUserID(), fetch(), and fetchList().

Makes a copy of the product collection it currently points to and sets the copied collection as the current collection.

Note:
This will store the order with the new product collection.
Returns:
the new collection or false if something failed.
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 137 of file ezorder.php.

static eZOrder::discount ( userID,
object 
) [static]
Returns:
the discountrules for a user

Definition at line 741 of file ezorder.php.

eZOrder::eZOrder ( row)

Definition at line 25 of file ezorder.php.

Referenced by active(), and orderList().

static eZOrder::fetchList ( asObject = true) [static]

Definition at line 178 of file ezorder.php.

Referenced by orderItems().

static eZOrder::fetchLocaleCurrencyCode ( ) [static]
Returns:
the local currency code, used by the price datatype.

Definition at line 1572 of file ezorder.php.

Referenced by currencyCode(), customerList(), orderStatistics(), and productList().

Get a new auto_increment id from a separate table ezorder_nr_incr.

Returns:
int the inserted id

Definition at line 1309 of file ezorder.php.

Referenced by activate().

static eZOrder::getShowOrdersQuery ( show,
table = null 
) [static]

Definition at line 196 of file ezorder.php.

Referenced by activeCount().

eZOrder::modifyStatus ( statusID,
userID = false 
)

Modifies the status on the order to $statusID. It will store the previous status in the history list using $userID.

Parameters:
$statusIDThe ID of the status that is to be set, this must be the global ID not the DB ID.
$userIDThe ID of the user that did the change, if false it will fetch the current user ID.
Note:
transaction safe
If you only want to change the status ID use the setStatus() function instead.

Definition at line 1180 of file ezorder.php.

Definition at line 1418 of file ezorder.php.

Definition at line 969 of file ezorder.php.

Referenced by orderInfo(), orderTotalExVAT(), and orderTotalIncVAT().

eZOrder::orderItemsByType ( itemType)
Parameters:
$typeOrder item type

Definition at line 978 of file ezorder.php.

static eZOrder::orderList ( CustomID,
Email 
) [static]
Returns:
list of products for a custom

Definition at line 421 of file ezorder.php.

static eZOrder::orderStatistics ( year = false,
month = false 
) [static]
Returns:
the number of active orders

Definition at line 282 of file ezorder.php.

Definition at line 873 of file ezorder.php.

Referenced by totalExVAT().

Definition at line 858 of file ezorder.php.

Referenced by totalIncVAT().

Returns:
the product collection which this order uses.

Definition at line 165 of file ezorder.php.

Referenced by detachProductCollection().

eZOrder::productItems ( asObject = true,
array $  sorts = null 
)

Fetch product items that bellongs ot the order.

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

Definition at line 759 of file ezorder.php.

Referenced by orderInfo(), productItemsOrdered(), productTotalExVAT(), and productTotalIncVAT().

eZOrder::productItemsOrdered ( asObject = true,
order = true 
)

Fetch product items ordered by id ( the order they where added to order )

Parameters:
bool$asObject
bool$orderTrue (default) for ascending[0->9] and false for decending[9->0]

Definition at line 829 of file ezorder.php.

static eZOrder::productList ( CustomID,
Email 
) [static]
Returns:
list of products for a custom

Definition at line 454 of file ezorder.php.

Definition at line 846 of file ezorder.php.

Referenced by totalExVAT().

Definition at line 834 of file ezorder.php.

Referenced by totalIncVAT().

eZOrder::purge ( removeCollection = true)

Removes the order.

shop/confirmorder calls this method passing $removeCollection set to false to purge the order if the user doesn't confirm it. Removing the product collection in this case would cause fatal error.

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.
Parameters:
$removeCollection(bool) specifies if we should remove product collection the order uses.

Definition at line 909 of file ezorder.php.

Removes the product collection this order uses.

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 926 of file ezorder.php.

Referenced by purge().

Removes the order status history for this order.

Note:
transaction unsafe

Definition at line 936 of file ezorder.php.

Referenced by purge().

static eZOrder::removeItem ( itemID) [static]

Removes the product collection item $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 955 of file ezorder.php.

Definition at line 943 of file ezorder.php.

Referenced by purge().

eZOrder::setStatus ( status)

Sets the status ID to $status and updates the status modification timestamp.

Note:
This does not create a status history element, use modifyStatus() instead.

Definition at line 1222 of file ezorder.php.

eZOrder::setStatusModified ( timestamp)

Sets the modification time of the status change to $timestamp.

Definition at line 1234 of file ezorder.php.

Referenced by setStatus().

eZOrder::status ( asObject = false)
Returns:
The status object if $asObject is true, otherwise the status ID.

Definition at line 1030 of file ezorder.php.

Returns:
A list of status items that the current user can set this order to.
Note:
If the user doesn't have any access at all for this order it will return an empty array.

Definition at line 1097 of file ezorder.php.

Returns:
The name of the current status.
Note:
It will cache the current status object in the $Status member variable to make multiple calls to this function fast.

Definition at line 1244 of file ezorder.php.

Returns:
The current status object.
Note:
It will cache the current status object in the $Status member variable to make multiple calls to this function fast.

Definition at line 1258 of file ezorder.php.

Definition at line 893 of file ezorder.php.

Definition at line 888 of file ezorder.php.

Returns:
the total VAT value of the order

Definition at line 964 of file ezorder.php.

static eZOrder::unArchiveOrder ( orderID) [static]

Unarchive an order, make it 'normal' again.

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 1380 of file ezorder.php.

Returns:
the user who has created the order.

Definition at line 986 of file ezorder.php.


Member Data Documentation

eZOrder::$Status

The cached status object or null if not cached yet.

Definition at line 1581 of file ezorder.php.

const eZOrder::SHOW_ALL = 2

Definition at line 23 of file ezorder.php.

Referenced by active(), and getShowOrdersQuery().

Definition at line 22 of file ezorder.php.

Referenced by getShowOrdersQuery().

Definition at line 21 of file ezorder.php.

Referenced by getShowOrdersQuery().


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