Properties and Methods for XSB 1.0
Back to the main page for XSB 1.0
The Object Model
Click on an object to view the properties and methods associated with it.
ShoppingBag Object -
LineItems Collection -
LineItem Object
ShoppingBag Object
Methods
Bool InitBag() |
Initializes the shopping bag. Call when you want to create a new shopping bag. Otherwise, call LoadBag. |
Bool LoadBag(BagData as String) |
Loads a shopping bag from a persisted state (eg, you can save the shopping bag data to a Session variable). |
String SaveBag() |
Saves a shopping bag. You can store the resulting string in a Session variable for later loading via LoadBag. |
Bool IsProductInBag(ProductId as String) |
Allows you to check whether a product is already in the shopping bag. |
Double Total() |
Calculates the overall total over all items in the shopping bag. |
Properties
LineItems Collection
Methods
Bool AddLineItem(ProductId as String,
ProductName as String,
QuantityPerUnit as String,
PricePerUnit as Double,
QuantityInBag as Long)
|
Creates a new line item with the given properties. By default, the quantity is set to one.
If the predefined properties aren't sufficient for your implementation,
see the documentation of LineItem for SetValue. |
Sub Remove(ProductId as Variant) |
Remove a line item either via index or ProductId. |
Properties
Long Count |
Returns the number of line items in the shopping bag. |
LineItem Item(ProductId as Variant) |
Retrieves the line item at the given index or via its ProductId. An error is raised
when the specified item does not exist. |
LineItem Object
Methods
Bool SetValue(KeyName as String,
KeyValue as Variant) |
Allows you to set additional properties for a line item. If an attribute does not exist,
it is automatically created. Be sure to use Server.HtmlEncode to remove special characters from the KeyValue. |
Variant GetValue(KeyName as String) |
Retrieves a custom attribute for a line item. If it does not exist, an error is raised. |
Properties
String ProductId |
Get only. Allows you to read the ProductId. |
String ProductName |
Get/Set. Allows to read and write the product's name. |
String QuantityPerUnit |
Get/Set. Allows to read and write the product quantity (eg, "5 bottles" or "250 ounces"). |
Double PricePerUnit |
Get/Set. Allows to read and write the price per unit for the product |
Long QuantityInBag |
Get/Set. Modify the quantity of the product in the bag. |
Double Total |
Get only. Calculates the total for this line item (QuantityInBag*PricePerUnit). |
|