iisCART2000™ Documentation

 

iisCART2000 -  METHODS

AcceptBillingInfo As String
Similar to AcceptShippingInfo. Retrieves the following input values from an HTML form:

NAME, COMPANY, ADDRESS1, ADDRESS2, CITY, STATEPROVINCE, ZIPPOSTAL, COUNTRY, EMAIL, COMMENTS,  CCTYPE, CCNUMBER, CCNAME, PHONE, CCMONTH, CCYEAR, CUSTOM1-8. This method considers the following values "required": NAME, ADDRESS1, CITY, ZIPPOSTAL, COUNTRY, CCTYPE, CCNAME, CCNUMBER, CCMONTH, CCYEAR, PHONE. Returns a list of missing variables. You may ignore the return value and write your own validation script before or after calling this method.  You may also override the validation with the validate method.

Cart.AcceptBillingInfo

AcceptShippingInfo As String
Call this method to accept the shipping info coming from an HTML form containing the following input variables:

BILLINGSAMEASSHIPPING, STATERESIDENT, COUNTRYRESIDENT, SHIPNAME, SHIPCOMPANY, SHIPADDRESS1, SHIPADDRESS2, SHIPCITY, SHIPSTATEPROVINCE, SHIPZIPPOSTAL, SHIPCOUNTRY, SHIPEMAIL, SHIPPING, SHIPCOMMENTS, SHIPPHONE, SHIPFAX, CUSTOM1-8.

This method retrieves the input variables listed above from an HTML form. The calculate method does tax calculations based on the tax rates and whether the STATERESIDENT and COUNTRYRESINDENT checkboxes are checked.

The calculate shipping method uses information collected by accept shipping info to calculate the shipping value based on the info in the SHIPPING variable.

The method returns a list of fields that it considers "required" and that were not specified by the user. The "required" fields are SHIPNAME, SHIPADDRESS1, SHIPCITY, SHIPZIPPOSTAL, SHIPCOUNTRY, SHIPPHONE. You may ignore the return value and write your own validation script after or before calling this method.  Can override with validate method as well.

Cart.AcceptShippingInfo

 
AddToCart(ItemID, Quantity)
Adds an item to the cart. If ItemID is not specified the method will look for the Request("ItemID") value. If the value is not found, the method will do nothing. If Quantity is not specified, the method will look for the value Request("Quantity"). If the value is not found, it will assume the value 1.

Additional parameters that are not expected by the method are stored as custom properties (1 through 8).  ItemID must be present in the Items database table.  

NOTE: Any data in the querystring or posted to addtocart that is not recognised is viewed as a property.  If you wish to post data for another reason and don't want addtocart to treat this data as a property then prefix any field names with ignore.  E.g. ignoremydata

NEW:  If itemid / quantity are specified the component will lookup the item in the database and add it.  If you specify more than the itemid and quantity the component will add the item directly from the page and not lookup in the database.  E.g.

<input type="hidden" name="ITEMID2" value="8888">
<INPUT type="hidden" name="itemname" VALUE="Turtle Neck Shirt">
<INPUT type="hidden" name="price" VALUE="35.99">
<INPUT type="hidden" NAME=WEIGHT VALUE="15">

Options for hidden data Include all items properties.  See docs under properties for details.

Also can be used at the script level programmatically e.g.
Cart.AddToCart (ItemID, Quantity, ItemName, ItemPrice, ItemWeight, ItemDescription, ItemAdjustRate, ItemAdjust, ItemTaxRate, ItemTax,  ItemCustom1,  ItemCustom2, ItemCustom3, ItemCustom4,  ItemCustom5,  ItemCustom6,  ItemCustom7,  ItemCustom8, Property1, Property2, Property3, Property4, Property5, Property6, Property7, Property8 )

When adding programmatically properties are not coming from forms and therefore must be in the following format. "name=value&datastring"  e.g. "Color=Blue&COMBO;Blue,Red,Green"

 
Calculate
Calculates carts totals, discounts, etc.  This method should be called when you want accurate cart totals and discount amounts.

Calculate :
Items level
-Tax calculation based on Item.TaxRate
-Adjust calculation based on Item.AdjustRate
-Property adjust calculation based on Adjustment set in DataString
Cart level
-TotalTax calculation based on Cart.CountryTaxRate & Cart.StateTaxRate & any item level overrides
-Adjust calculation based on Cart.TotalAdjustRate
-Total Quantity
-Total Weight - Cart.Weight
-PreTaxTotal(after adjust)-Cart.GridTotal
-Total(after Tax)-Cart.total
-gridtotalquantity

Cart.Calculate
 
CalculateShipping
Calculates shipping for cart.

SHIPPING CALCULATION:  Shipping is calculated on an optional base charge + per unit weight * item weight.  You can customize the form found in the sample store, checkout.asp.  e.g.

<select NAME="SHIPPING" size="1">
<option VALUE="Priority Mail:3.95;8.00">US Priority Mail</option>
<option VALUE="DHL:5.95;12.00">DHL</option>
</select>

Here a shipping type Priority Mail is defined with a 3.95 per item weight charge and 8.00 base charge. 

This method can also work in conjunction with the iisCARTship realtime shipping component. See sample checkout.asp that ships with iisCARTship for details.  If the shipping type is selected as iisCARTship then it expects shiptype:price e.g.

<option value="iiscartship:XPR;55.25">UPS 55.25 XPR None </option>

 
CC As Object
Returns a CreditCard auxiliary object that can be used to set various properties of the CC processing module.  See docs on CC object for more details.

Cart.cc.x
 
cc.Charge
Runs a realtime transaction with cybercash.  Requires iisCARTcc. Result returns as 1,2,3.  1 means success.  2 means that iisCARTcc returned an error and the message is populated in cart.cc.lastccerrormsg.  3 means the processor returned an error also stored in lastccerrormsg.

result = Cart.cc.charge
 
Decrypt (cipertext, password)
Decrypts ciphertext into plain text with password.

Cart.Decrypt( cipertext, "password" )
 
DisplayCart(Optional DoNotShow as String, Optional ShowCustom)
Displays the cart content as a table with a variety of inteface / update button option.  See updatebuttons method for additional details. Handles remove and update commands from the user. DoNotShow contains a list of comma-separated header names that should not be shown, e.g. "Description, Item ID". ShowCustom specified the header names for Cusom1 to Custom8 fields to be displayed in the table. This parameter may contain 0 to 8 comma-separated names. By default, the method will not display custom fields.

Cart.DisplayCart "item id, description", "Custom1, Custom2"
 
DisplayCartReadOnly(Optional DoNotShow as String, Optional ShowCustom)
Same as DisplayCart but does not display the Remove column or Update Cart button(s).

Cart.DisplayCartReadOnly "item id, description", "Custom1, Custom2"
 
EmptyCart
Removes all items from the cart.

Cart.EmptyCart
 
Encrypt (data, password)
Encrypts data with password key.  Returns encrypted string.

Cart.Encrypt( "text", "password" )
 
HandleCommands
Handles cart commands from displaycart.  For example, updating the cart, changing properties, quantities etc.  Must be called prior to displaycart and calculate.  

Cart.HandleCommands
 
LoadCart (string)
Loads the cart back from a string

Cart.LoadCart Session("Cart")
 
LoadCartDB (id)
Loads Cart from DB (cart table) expects input as cart id.  If you are using this method to maintain state you need to set the connectstring property on a per page basis.

Cart.LoadCartDB 45
 
LoadCustomerDB(email, password)
Loads customer based on shipemail address and password.  Populates info collection on successful load.  Also returns error codes on failure that can be handled in script. 1 = no email 2 = no password 3 = no matching email / password.

Cart.LoadCustomerDB "customer@email.com", "password"
 
LoadItems(string)
Loads just cart items from string.

Cart.LoadItems MyItemString
 
LoadItemsDB(id)
Loads just cart items from DB (cart table). Takes parameter as ID.

Cart.LoadItemsDB 63
 
Register (filename.enc)
Adds registration key. The asp script that runs the register method should be in the same directory as your key file.  Returns yes or no on success.  Can be used with the following syntax:

if cart.register then
   response.write "Key added sucessfully."
else
   response.write "Error adding key."
end if
 
RemoveFromCart( Optional ItemID, Optional Quantity)
Removes an item from the cart. If ItemID is not specified the method will look for the Request("ItemID") value. If the value is not found, the method will do nothing. If Quantity is not specified, the method will look for the value Request("Quantity"). If the value is not found, it will assume the value 1.

Cart.RemoveFromCart "1111", "2"
 
SaveCart
Saves cart to string.

Session("Cart") = Cart.SaveCart
 
SaveCartDB(optional ID)
Saves cart as string in database (to cart table).  Returns ID which could be pushed to a cookie, stored in querystring etc. 0 is returned if the operation failed. When an ID is specified the matching record will be updated rather than a new record created.  If customerid is set (loadcustomerdb is run) then this id is also written to the cart table.  If you are using this method to maintain state you need to set the connectstring property on a per page basis.

Cart.SaveCartDB
 
SaveCustomerDB(optional ID)
Saves custom details to database.  Expects form elements including info collection (billing and shipping) plus password.  See example script: savecustomer.asp   When an ID is specified the matching record will be updated rather than a new record created.  Returns error string similar to acceptshippinginfo and acceptbillinginfo.

Cart.SaveCustomerDB
 
SaveItems
Saves cart items as string.

MyString = Cart.SaveItems
 
SaveItemsDB(optional ID)
Saves cart items as string in database (to cart table).  Can be used to persist cart contents for any length of time.  Returns ID of saved data which could be pushed as a cookie and later requested.  0 is returned if the operation failed.  When an ID is specified the matching record will be updated rather than a new record created.  If customerid is set (loadcustomerdb is run) then this id is also written to the cart table.

Cart.SaveItemsDB
 
SaveOrderEncrypt(virtual path, password, optional filename)
Writes complete order as encrypted binary to disk.  Can be use to create attachment to email to remote order processing.  Perfect for small companies.  If orderid set or saveorderdb method used then filename is not required and will be orderid.  As with all iisCART2000 methods that take inputs as a path, this is a virtual path.  e.g. "/orders" not "c:\inetpub\wwwroot\orders"

A client application, iisCARTdecrypt.exe can be used on Win9x and NT clients to locally decrypt the binaries that SaveOrderEncrypt creates.  This client program can be found in the /docs directory.

Cart.SaveOrderEncrypt "/orders", "Password","filename"
 
SaveOrderDB
Saves the full order details to the database in the following tables: Orders, orderitems, customers.  Customers data is not saved again if the customer data was loaded back with loadcustomerdb.

Cart.SaveOrderDB
 
SaveOrderItemsDB
Saves the full order details to the database in the following tables: Orders, orderitemsex, customers.  This method should be used when you need the full items details to be written to the database as you do not have any items stored in your items table.  e.g. when you are using another database for your items data or just have the items encoded in your web pages html.

Cart.SaveOrderItemsDB
 
SaveUpload(virtual path)
Allows browser based upload of files.  Saves posted data to virtual path.  e.g. "/upload"

Cart.SaveUpload "/images"
 
SetFont(Face As String, Optional Size, Optional Color)
Sets the FACE, SIZE and COLOR attributes of the <FONT> tag for body text in the cart table.

Cart.SetFont "Tahoma, Arial", 3, "#000000"
 
SetHeaderFont(Face As String, Optional Size, Optional Color)
Sets the FACE, SIZE and COLOR attributes of the <FONT> tag for header text in the cart table.

Cart.SetHeaderFont "Tahoma, Arial", 3, "#FFFFFF"
 
SetPropertyFormat(type)
Sets the property format.  There are 4 options:  Value, NameValue, EditValue, and NameEditValue

Cart.SetPropertyFormat "NameEditValue"
 
SetTableProperties(Width As String, CellPadding As Integer, CellSpacing As Integer, Border As Boolean)
Sets WIDTH, CELLPADDING, CELLSPACING, and BORDER properties of the Cart table’s <TABLE> tag. If this method is not called, the attributes will be omitted.

Cart.SetTableProperties "100%", 2, 0, 1
 
UpdateButtons(updatebutton, showbuttons, quantitydisplay)
Controls update buttons at cart or items level or none, (remove item, add 1 quantity, remove 1 quantity), and the quantity display.

UpdateCart=update.gif or UpdateItems=update.gif or none
any or all of:  x.gif,-.gif, +.gif
edit or display

UpdateButtons "UpdateCart=Update.gif", "x.gif,-.gif, +.gif" , "edit"

 
Validate
Overrides default validation of fields as per acceptshippinginfo.  This method should be used in checkout.asp before the acceptbillinginfo method. e.g. Cart.Validate "name, company, city, email"  Now also accepts value returned if not included.  e.g. Cart.Validate "name=Full Name"  would return that Full Name was required if name had no value.  Useful for language conversions.

CCERROR is an optional value which can be set and controls the return of acceptbillinginfo's credit card number and expiry check.  e.g. Cart.validate "CCERROR=invalid credit card details"

 

� Corporate Web Solutions 1998, 1999, 2000, 2001.