|
|
 |
The Freelancers challenge...
date posted 19th January 2001 10:51
Hi all, just a quickie (to someone who knows about shopping carts).
I have the following script as my "confirm order" page for my shopping cart. The question is, how do I mail it. I'm not a fluent coder as you can probably tell. I have tried using cdo mail and putting script no. as the body, to collect the string values of the cart but i ain't doing. I've been banging my head against a wall for 3 days now...there must be a way to email the cart values and the purchasers details. The cart resides at www.nydeli.co.uk/bookstoreexample/productlist.asp
Please help!!!many many many thanks to whoever can crack this one!!!
here's the scripts....
1.
[EMAIL REMOVED] if (cStr(Request("Submit")) "") Then
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = [EMAIL REMOVED]
objCDO.To = [EMAIL REMOVED]
objCDO.CC = ""
objCDO.Subject = "test"
objCDO.Body = ""
objCDO.Send()
Set objCDO = Nothing
Response.Redirect("thankyou.asp")
End If
%>
//
// UltraDev UCart include file Version 1.0
//
function UC_ShoppingCart(Name, cookieLifetime, colNames, colComputed) // Cart constructor
{
// Name is the name of this cart. This is not really used in this implementation.
// cookieLifeTime is in days. A value of 0 means do not use cookies.
// colNames is a list of column names (must contain: ProductID, Quantity, Price, Total)
// colComputed is a list of computed columns (zero length string means don't compute col.)
// Public methods or UC_Cart API
this.AddItem = UCaddItem; // Add an item to the cart
this.GetColumnValue = GetColumnValue; // Get a value from the cart
this.Destroy = UCDestroy; // remove all items, delete session, delete client cookie (if any)
this.SaveToDatabase = SaveToDatabase; // persist cart to database.
this.GetItemCount = GetItemCount; // the number of items in the cart.
this.Update = Update; // Update the cart quantities.
this.GetColumnTotal = GetColumnTotal; // Get the sum of a cart column for all items (e.g. price or shipping wt.).
this.GetContentsSerial = UCGetContentsSerial// Get the contents of the cart as a single delimited string
this.SetContentsSerial = UCSetContentsSerial// Set the contents of the cart from a serial string (obtained from GetContentsSerial)
this.GetColNamesSerial = UCGetColNamesSerial// Get the list of column names as a delimited string.
// PROPERTIES
this.SC = null; // Cart data array
this.numCols = colNames.length;
this.colComputed = colComputed;
this.colNames = colNames;
this.Name = Name;
this.cookieLifetime = cookieLifetime;
this.bStoreCookie = (cookieLifetime != 0);
// *CONVENIENCE* PROPERTIES
// (not used internally, but added to provide a place to store this data)
this.CustomerID = null;
this.OrderID = null;
this.Tax = null;
this.ShippingCost = null;
// CONSTANTS
this.PRODUCTID = "ProductID"; // Required SKU cart column
this.QUANTITY = "Quantity"; // Required Quantity cart column
this.PRICE = "Price"; // Required Price cart column
this.TOTAL = "Total"; // Required Total column
this.cookieColDel = "#UC_C#"
this.cookieRowDel = "#UC_R#"
// METHODS
this.AssertCartValid = AssertCartValid
// Private methods - don't call these unless you understand the internals.
this.GetIndexOfColName = UCgetIndexOfColName;
this.GetDataFromBindings = UCgetDataFromBindings;
this.FindItem = UCfindItem;
this.ComputeItemTotals = ComputeItemTotals;
this.persist = UCpersist;
this.BuildInsertColumnList = BuildInsertColumnList;
this.BuildInsertValueList = BuildInsertValueList;
this.UpdateQuantities = UpdateQuantities;
this.UpdateTotals = UpdateTotals;
this.DeleteItemsWithNoQuantity = DeleteItemsWithNoQuantity;
this.CheckAddItemConfig = CheckAddItemConfig;
this.ColumnExistsInRS = ColumnExistsInRS;
this.DeleteLineItem = DeleteLineItem;
this.GetCookieName = GetCookieName;
this.SetCookie = SetCookie;
this.PopulateFromCookie = PopulateFromCookie;
this.DestroyCookie = UCDestroyCookie;
// Cart "internals" documentation:
// The this.SC datastructure is a single variable of type array.
// Each array element corresponds to a cart column. For example:
// Array element 1: ProductID
// Array element 2: Quantity
// Array element 3: Price
// Array elemetn 4: Total
//
// Each of these is an array. Each array index corresponds to a line item.
// As such, each array should always be exactly the same length.
this.AssertCartValid(colNames, "Cart Initialization: ");
if (Session(this.Name) != null) {
this.SC = Session(this.Name).SC;
} else {
this.SC = new Array(this.numCols);
for (var i = 0; i < this.numCols; i++) this.SC[i] = new Array();
// Since the cart doesn't exist in session, check for cookie from previous session
if (this.bStoreCookie){
cookieName = this.GetCookieName();
cookieStr = Request.Cookies(cookieName);
if (cookieStr != null && String(cookieStr) != "undefined" && cookieStr != "")
this.PopulateFromCookie(cookieStr);
}
// Create a reference in the Session, pass the whole object (methods are not copied)
this.persist();
}
}
// convert vb style arrays to js style arrays.
function UC_VbToJsArray(a) {
if (a!=null && a.length==null) {
a = new VBArray(a);
a = a.toArray();
}
return a;
}
function UCpersist() {
Session(this.Name) = this;
if (this.bStoreCookie) this.SetCookie();
}
function UCDestroy(){
this.SC = new Array(this.numCols); // empty the "in-memory" cart.
for (var i = 0; i < this.numCols; i++) this.SC[i] = new Array();
this.persist();
if (this.bStoreCookie) this.DestroyCookie() // remove the cookie
}
function UCgetDataFromBindings(adoRS, bindingTypes, bindingValues) {
var values = new Array(bindingTypes.length)
for (i=0; i=0, "UC_Cart.js: Internal error 143");
assert(indexQuantity >=0, "UC_Cart.js: Internal error 144");
var newRow = -1
for (var iRow=0; iRow |
 |
|