Class OrderHistory
The class provides access to past orders of the customer.
Note: This class allows access to sensitive financial and cardholder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. It also allows access to sensitive personal and private information. Pay attention to appropriate legal and regulatory requirements related to this data. Note: The following methods do not work with Salesforce Order Management orders.
| Property | Description |
|---|---|
orderCount: Number (read-only) | Returns the number of orders the customer has placed in the store. |
orders: SeekableIterator (read-only) | Retrieves the order history for the customer in the current storefront site. |
This class does not have a constructor, so you cannot create it directly.
| Method | Description |
|---|---|
| getOrderCount() | Returns the number of orders the customer has placed in the store. |
| getOrders() | Retrieves the order history for the customer in the current storefront site. |
| getOrders(String, String, Object...) | Retrieves the order history for the customer in the current storefront site. |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
- orderCount: Number
(read-only) Returns the number of orders the customer has placed in the store.
If the customer is anonymous, this method always returns zero. If an active data record is available for this customer, the orders count is retrieved from that record, otherwise a real-time query is used to get the count.
- orders: SeekableIterator
(read-only) Retrieves the order history for the customer in the current storefront site.
If the result exceeds 1000 orders, only the first 1000 orders are retrieved. Same as
It is strongly recommended to call
[SeekableIterator.close()](dw.util.SeekableIterator.md#close)on the returned SeekableIterator if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.See Also:
- getOrderCount(): Number
Returns the number of orders the customer has placed in the store.
If the customer is anonymous, this method always returns zero. If an active data record is available for this customer, the orders count is retrieved from that record, otherwise a real-time query is used to get the count.
Returns:
- the number of orders the customer has placed in the store.
- getOrders(): SeekableIterator
Retrieves the order history for the customer in the current storefront site.
If the result exceeds 1000 orders, only the first 1000 orders are retrieved. Same as
It is strongly recommended to call
[SeekableIterator.close()](dw.util.SeekableIterator.md#close)on the returned SeekableIterator if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.Returns:
- the orders
See Also:
- getOrders(query: String, sortString: String, params: Object...): SeekableIterator
Retrieves the order history for the customer in the current storefront site.
If the result exceeds 1000 orders, only the first 1000 orders are retrieved. Optionally, you can retrieve a subset of the orders by specifying a query. At maximum 3 expressions are allowed to be specified and no custom attribute expressions are allowed.
It is strongly recommended to call
[SeekableIterator.close()](dw.util.SeekableIterator.md#close)on the returned SeekableIterator if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.Example:
Parameters:
- query - optional query
- sortString - optional sort string
- params - optional parameters for the query
Returns:
- the orders