CHAPTER 7 Basket Object

ProgID: ACBOrder.tBasket

Description

The Basket object provides an interface to a customer basket. It gives access to the products currently stored in the basket and allows manipulation of its contents.

 

Customer_ID

Read Only. This property holds the ID of the Customer currently loaded in the Basket object.

IsComplete

Read Only. A Boolean value that indicates whether or not this order has been completed.

IsDirty

Read/Write. Holds a boolean value that indicates whether the data in this object has been changed and requires a database update.

Order_ID

Read Only. This property holds the Order ID that is associated with this basket.

OrderDT

Read Only. This property holds the date and time an order was completed. This is always an empty string for the Basket object.

Status

Read Only. This property holds the current status of the order. This is always 0 for the Basket object.

Store_ID

Read Only. This property holds the Store ID that is associated with this basket

 

BillAddr

Returns a reference to the billing address object of the active basket

CalculateShipping

This method calculates and stores the current shipping cost for all shipments in the basket based on current shipping addresses and selected methods set in the Shipments collection.

CalculateTaxes

This method calculates and stores all applicable taxes for the basket.

CheckoutXML

This method executes the checkout process for the current basket using provided payment information.

Fees

Returns an OrderItems collection that contains all fee items in the current basket.

ItemCount

Returns the total number of items in the basket.

Load

Loads the basket from the database for the specified customer.

OrderItems

Returns an OrderItems collection that contains all items (including products and fees) in the current basket.

Package

This method organizes the basket contents into separate shipments based on product ship from location(s). This method should be called before shipping methods are assigned.

Products

Returns an OrderItems collection that contains all products in the current basket.

Reset

Resets the object, freeing any allocated resources.

Save

This method commits to the database all changes made to the object.

Shipments

Returns a reference to the Shipments collection of the active basket.

TotalCost

Returns the total cost of all items in the basket.

TotalWeight

Returns the total weight of all items in the basket.

Transfer

This method copies the contents of one basket to another.

BillAddr Method

Returns a reference to the billing address object of the active basket.

Syntax

Set objAddress = objBasket.BillAddr

Return Value

Returns an ACBUsers.tAddress object reference.

CalculateShipping Method

This method calculates and stores the current shipping cost for all shipments in the basket based on current shipping addresses and selected methods set in the Shipments collection. This method should be called before Checkout.

Syntax

objBasket.CalculateShipping

CalculateTaxes Method

This method calculates and stores all applicable taxes for the basket. This method should be called before Checkout.

Syntax

objBasket.CalculateTaxes

CheckOutXML Method

This method executes the checkout process for the current basket using provided payment information. The order is marked as completed, the credit card is charged (if real time processing is enabled), inventory is decremented, and all basket data is committed to the database.

Syntax

xmlResponse = objBasket.CheckOutXML(xmlRequest)

Return Value

Returns an XML document that contains the result code. An error message is also included if the payment is not successful. The XML structure of the return document is detailed below.

 

XPath

Type

Description

/CheckoutResponse/ErrorCode

Integer

Contains the result code for the checkout process. 0 indicates no error. A non-zero result indicates the checkout was not sucessful.

/CheckoutResponse/ErrorMessage

String

Contains an error message that describes the result. If error code is 0, this may be empty.

Parameters

xmlRequest [in] An XML document that contains all information required to complete this checkout. The required elements of the XML document are listed below. For more details on the XML payment system (including code samples), see the supplemental document "CommerceBuilder Payment Gateway Integration".

 

XPath

Type

Description

/CheckoutRequest/PayMeth_ID

Integer

Identifies the requested payment method.

/CheckoutRequest/Account

Container

Contains data elements related to an account of the type specified by the payment method.

/CheckoutRequest/Account/AccountNumber

AlphaNumeric

Specifies the account used for checkout. e.g. credit card number

/CheckoutRequest/HTTPEnv

Container

Contains data elements that specify the HTTP environment of the customer.

/CheckoutRequest/HTTPEnv/RemoteAddr

AlphaNumeric

Stores the IP address of the customer requesting the checkout.

/Checkout Request/HTTPEnv/HTTPReferer

AlphaNumeric

Stores the URL of the last page visisted by the customer. This data should be URL encoded.

Fees Method

Returns an OrderItems collection that contains all fees in the current basket.

Syntax

Set colFees = objBasket.Fees

Return Value

Returns an ACBOrder.cOrderItems object reference loaded with a fees filter.

ItemCount Method

Returns the number of items in the basket.

Syntax

intItemCount = objBasket.ItemCount([intFilter])

Parameters

intFilter [in] Optional. An integer value that indicates the filter to use when counting the basket items. Valid values are 0 (no filter), 1 (products only), -1 (fee items only). 0 is the default.

Return Value

Returns a Long value containing the total number of items in the basket.

Load Method

Loads the basket object from the database for the specified customer.

Syntax

boolean = objBasket.Load(objToken), [intCustomerID], [blnCreate])

Return Value

Returns a boolean value indicating success (true) or failure (false).

Parameters

objToken [in] A reference to a loaded Token object.

intCustomerID [in] Optional. A long value indicating the customer for which to load the basket. The default is the active customer as specified by the Customer_ID property of objToken.

blnCreate [in] Optional. A boolean value that specifies whether or not to create a basket record if it does not exist. When true, the basket is created. When false, the Load method fails (returns false). Default is true.

OrderItems Method

Returns an OrderItems collection that contains all items (including products and fees) in the current basket.

Syntax

Set colOrderItems = objBasket.OrderItems

Return Value

Returns an ACBOrder.cOrderItems object reference loaded without any filter.

Package Method

This method organizes the basket contents into separate shipments based on product ship from location(s). This method should be called before shipping methods are assigned.

Syntax

blnSuccess = objBasket.Package

Return Value

Returns a Boolean value indicating success (true) or failure (false).

Products Method

Returns an OrderItems collection that contains all products in the current basket.

Syntax

Set objProducts = objBasket.Products

Return Value

Returns an ACBOrder.cOrderItems object reference loaded with a products filter.

Reset Method

Resets the object, freeing any allocated resources.

Syntax

objBasket.Reset

Notes

Reset should always be called before setting the object to nothing. This will force all allocated memory to be freed.

Save Method

This method commits to the database all changes made to the object.

Syntax

Boolean = objBasket.Save(strMessage)

Return Value

Returns a boolean value indicating success (true) or failure (false).

Parameters

strMessage [out] A string value that will be set by the method if errors are encountered during processing.

Shipments Method

Returns a reference to the Shipments collection of the active basket.

Syntax

Set objShipments = objBasket.Shipments

Return Value

Returns an ACBOrder.cShipments object reference.

TotalCost Method

Returns the total cost of all items in the basket.

Syntax

curTotalCost = objBasket.TotalCost([intFilter])

Parameters

intFilter [in] Optional. An integer value that indicates the filter to use when totaling the values in the collection. Valid values are 0 (no filter), 1 (products only), -1 (fee items only). 0 is the default.

Return Value

Returns a currency value containing the total cost.

TotalWeight Method

Returns the total weight of all items in the basket.

Syntax

curTotalWeight = objBasket.TotalWeight([intFilter])

Parameters

intFilter [in] Optional. An integer value that indicates the filter to use when totaling the values in the collection. Valid values are 0 (no filter), 1 (products only), -1 (fee items only). 0 is the default.

Return Value

Returns a currency value containing the total weight.

Transfer Method

This method copies the contents of one basket to another.

Syntax

objBasket.Transfer(objToken, intOldID, intNewID, [bMove])

Parameters

objToken [in] A reference to a loaded Token object.

intOldID [in] A long value indicating the customer ID the basket is transferred from.

intNewID [in] A long value indicating the customer ID the basket is transferred to.

bMove [in] Optional. A Boolean value that indicates whether the items in the old basket should be moved (true) or copied (false) to the new basket. Default is true.

Go to Main Go to Previous Go to Next