|
| |
<%If C_BNRBKGRND = "" Then%><%= C_STORENAME %><%Else%> <%End If%> |
| Your <%=Application("CartName")%> |
| Please
review your <%=Application("CartName")%> items as shown below. To
modify the quantity of any item, simply input the desired quantity
and select the Recalculate <%=Application("CartName")%> button.
To delete an item click on DELETE. To ADD an item to your order
for purchase, click on ADD. If you want to add new items, you
can do so by pressing RETURN TO SHOP and click on <%=Application("CartSaveButton")%>
for the appropriate product. You can access your <%=Application("CartName")%>
at any time.
|
| product |
unit
price |
qty |
price |
action |
<%
'@BEGINCODE
'-----------------------------------------------------------
' BEGIN PRODUCT DETAIL OUTPUT ------------------------------
' Note: will need code to alternate the colors between:
' C_ALTBGCOLOR1 and C_ALTBGCOLOR2 (and other items)
'-----------------------------------------------------------
Dim sSql, rsAllSvdOrders, sProdID, aProduct, aProdAttr, sProdName, sProdPrice, iProdAttrNum, iCounter
Dim sAttrUnitPrice, sUnitPrice, iQuantity, iNewQuantity, sProductSubtotal, dProductSubtotal, dTotalPrice, iSvdOrderID, aProdAttrID, sTotalPrice, sProductPrice
Dim iProductCounter, sBgColor, sFontFace, sFontColor, iFontSize
Dim sPaymentList, bHasProducts, sBtnAction, sAddCart, sDelete, iTmpCartID,sRecalculate, iAddFind, iDeleteFind, sReferer
Dim sErrorDescription, sSearchPath, aProdValues, iShip
Dim bProd_Inactive
' Determine action and OrderID
For iCounter = 1 to Request.Form("iProductCounter")
sAddCart = Request.Form("AddToCart" & iCounter & ".x")
If sAddCart <> "" Then
iAddFind = iCounter
sBtnAction = "AddToCart"
Exit For
End If
sDelete = Request.Form("DeleteFromOrder" & iCounter & ".x")
If sDelete <> "" Then
iDeleteFind = iCounter
sBtnAction = "DeleteFromCart"
Exit For
End If
Next
' Determine if it is recalculate action
sRecalculate = Request.Form("Recalculate.x")
If sRecalculate <> "" Then
sBtnAction = "Recalculate"
End If
' Recalculate subtotal
If sBtnAction = "Recalculate" Then
Dim iTmpOrderID, iOldQuantity
For iCounter = 1 To Request.Form("iProductCounter")
iNewQuantity = Request.Form("FormQuantity" & iCounter)
iOldQuantity = Request.Form("iQuantity" & iCounter)
iSvdOrderID = Request.Form("iSvdOrderID" & iCounter)
if not isnumeric(iNewQuantity) or trim(iNewQuantity) ="" then
iNewQuantity = iOldQuantity
end if
If iNewQuantity <> "" Then
If iNewQuantity = 0 Then
' Delete if 0
Call setDeleteOrder("odrdtsvd",iSvdOrderID)
ElseIf iNewQuantity <> iOldQuantity Then
' Update Quantity For Product
Call setReplaceQuantity("odrdtsvd",iNewQuantity,iSvdOrderID)
End If
Else
' Delete if Null Value
Call setDeleteOrder("odrdtsvd",iSvdOrderID)
End If
Next
' Save to Cart
ElseIf sBtnAction = "AddToCart" Then
sProdID = Request.Form("sProdID" & iAddFind)
iSvdOrderID = Request.Form("iSvdOrderID" & iAddFind)
iQuantity = Request.Form("iQuantity" & iAddFind)
iProdAttrNum = Request.Form("iProdAttrNum" & iAddFind)
iCustID = Request.Cookies("sfCustomer")("custID")
sReferer = Session("HttpReferer")
iNewQuantity = Request.Form("FormQuantity" & iAddFind)
aProdValues = getProdValues(sProdID,iQuantity)
iShip = aProdValues(3)
' Check to see if custID exists in customer table
If iCustID <> "" Then
bCustIdExists = CheckCustomerExists(iCustID)
If bCustIdExists = false Then
Response.Cookies("sfCustomer")("custID") = ""
Response.Cookies("sfCustomer").Expires = NOW()
End If
End If
' In the case that one types in a new quantity and hits add
If iNewQuantity <> iQuantity And iNewQuantity <> "" Then
iQuantity = iNewQuantity
End If
If iProdAttrNum <> "" AND iProdAttrNum > 0 Then
Redim aProdAttr(iProdAttrNum)
aProdAttr = getProdAttr("odrattrsvd",iSvdOrderID,iProdAttrNum)
End If
iTmpCartID = getOrderID("odrdttmp","odrattrtmp", sProdID,aProdAttr,cInt(iProdAttrNum))
If iTmpCartID <> "" Then
' New Row in SavedCartDetails
If iTmpCartID < 0 Then
' Write as new row
iTmpCartID = getTmpTable(aProdAttr,sProdID,iQuantity,sReferer, iShip)
' Existing cart
Else
' Update Quantity
Call setUpdateQuantity("odrdttmp",iQuantity,iTmpCartID)
' End existing saved cart If
End If
Else
Response.Write "Number of attributes not equal to the product specs or database writing error"
' ++ Response.Redirect("error.asp")
' End iTmpCartID Null If
End If
SaveCart_WriteSvdtmpAERecord 'SFAE
' delete from sfSavedOrderDetails
Call setDeleteOrder("odrdtsvd",iSvdOrderID)
ElseIf sBtnAction = "DeleteFromCart" Then
' Remove from cart
iSvdOrderID = Request.Form("iSvdOrderID" & iDeleteFind)
Call setDeleteOrder("odrdtsvd",iSvdOrderID)
End If
iProductCounter = 0
dTotalPrice = 0
'-----------------------------------------------------------------
' Collect all orders associated with Session ::: Begin
'-----------------------------------------------------------------
' Get a RecordSet of all orders
' Check cookies and other indicators of login
If (Request.Cookies("sfCustomer")("custID") = "" OR Request.Cookies("sfOrder")("SessionID") = "" OR Request.Cookies("sfOrder")("SessionID") <> Session("SessionID")) Then
Dim sSubmitAction
sSubmitAction = "this.form=true;return sfCheck(this);"
bLoggedIn = false
%>
|
<%
Else
iCustID = Request.Cookies("sfCustomer")("custID")
Call setCombineProducts(iCustID)
sSql = "SELECT * FROM sfSavedOrderDetails WHERE odrdtsvdCustID=" & iCustID
If vDebug = 1 Then Response.Write " " & sSql
Set rsAllSvdOrders = cnn.execute(sSql)
' Check for no orders
If rsAllSvdOrders.EOF Then
bHasProducts = False
%>
|
No Items in <%=Application("CartName")%>
Please press return to shop button to begin searching for
items.
|
<%
Else
bHasProducts = True
Do While NOT rsAllSvdOrders.EOF
bProd_Inactive = False
' Get the ProdIDs
iSvdOrderID = rsAllSvdOrders.Fields("odrdtsvdID")
sProdID = rsAllSvdOrders.Fields("odrdtsvdProductID")
iQuantity = rsAllSvdOrders.Fields("odrdtsvdQuantity")
' Get an array of 3 values from getProduct()
'++ On Error Resume Next
ReDim aProduct(3)
aProduct = getProduct(sProdID)
If trim(aProduct(0)) ="" Then
bProd_Inactive = True
aProduct(0) = "No longer Available"
aProduct(1) = "-"
aProduct(2) = "-"
End if
sProdName = aProduct(0)
sProdPrice = aProduct(1)
iProdAttrNum = aProduct(2)
' ++ Call CheckForError()
' If not an array, then the product does not exist
If NOT IsArray(aProduct) Then
Response.Write " Product Does Not Exist"
' ++ Needs to MoveNext to iterate through the rest of the order
Else
If NOT IsNumeric(iProdAttrNum)Then
iProdAttrNum = 0
End If
' Get Associated Attribute IDs in an array
If iProdAttrNum <> "" Then
ReDim aProdAttrID(iProdAttrNum)
aProdAttrID = getProdAttr("odrattrsvd",iSvdOrderID,iProdAttrNum)
End If
' Response Write all Output
If vDebug = 1 Then
Response.Write "Product = " & sProdID & " ProdName = " & sProdName & " ProdPrice = " & sProdPrice & " ProdAttrNum = " & iProdAttrNum
'Call ShowRow("odrdtsvd","odrattrsvd",iSvdOrderID,sProdID)
If IsArray(aProdAttrID) Then
For iCounter = 0 To iProdAttrNum -1
Response.Write " Attribute :" & aProdAttrID(iCounter)
Next
End If
End If
iProductCounter = iProductCounter + 1
dim fontclass
' Do alternating colors and fonts
If (iProductCounter mod 2) = 1 Then
fontclass="tdAltFont1"
Else
fontclass="tdAltFont2"
End If
%>
<%
'-----------------------------------------------------------
' SUBTOTAL OUTPUT taken out 'SFUPDATE
'-----------------------------------------------------------
%>
<%
' End rsAllSvdOrders If
End If
' End Cookie If
End If
' Determine search path
If Request.Cookies("sfSearch")("SearchPath") <> "" Then
sSearchPath = Request.Cookies("sfSearch")("SearchPath")
If InStr(LCase(sSearchPath), LCase("login.asp")) <> 0 Then
sSearchPath = "search.asp"
End If
Else
sSearchPath = "search.asp"
End If
%>
<% If bLoggedIn = true Then %>
<%
If bHasProducts Then
SaveCart_ShowEmailWishListButton 'SFAE
End If
End If %>
<%If bHasProducts Then %>
Please Note: None of these items will
be in checkout unless you explicitly add them to your order.
<%End If %>
|
|
|
| |
|