%@LANGUAGE="VBSCRIPT"%>
<%
'option explicit
Response.Expires=-1
%>
<%
'** Open the connection for cart nav
Dim Conn, strSql
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open MM_connCart_STRING
%>
<%
Dim errMsg
errMsg = ""
If Len(Request.QueryString("pID")) = 0 Then
errMsg = "No Product was selected."
End If
%>
<%
UC_CartColNames=Array("ProductID","Quantity","Name","Options","Color","Size","TotalWeight","Weight","Price","Total")
UC_ComputedCols=Array("","","","","","","Weight","","","Price")
set UCCart1=VBConstuctCart("UCCart",0,UC_CartColNames,UC_ComputedCols)
UCCart1__i=0
%>
<%
Dim intProductID
intProductID = Request.QueryString("pID")
'__________________________________________________________________________________________________
If len(intProductID) <> 0 Then
%>
<%
Dim rsProduct
Dim rsProduct_numRows
'Construct the listing
strSql = "EXEC usp_ac_ProdInventoryCounts @ProductID=" & intProductID
Set rsProduct = Server.CreateObject("ADODB.Recordset")
rsProduct.Open strSql, Conn
rsProduct_numRows = 0
%>
<%
Dim rsColor
Dim rsColor_numRows
'Construct the listing
strSql = "EXEC usp_ac_ProdColors @ProductID=" & intProductID
Set rsColor = Server.CreateObject("ADODB.Recordset")
rsColor.Open strSql, Conn
rsColor_numRows = 0
%>
<%
Dim rsSize
Dim rsSize_numRows
'Construct the sizes listing
strSql = "EXEC usp_ac_ProdSizes @ProductID=" & intProductID
Set rsSize = Server.CreateObject("ADODB.Recordset")
rsSize.Open strSql, Conn
%>
<%
Dim rsOption
Dim rsOption_numRows
'Construct the sizes listing
strSql = "EXEC usp_ac_ProdOptions @ProductID=" & intProductID
Set rsOption = Server.CreateObject("ADODB.Recordset")
rsOption.Open strSql, Conn
rsOption_numRows = 0
%>
<%
Dim rsRelatedProd
Dim rsRelatedProd_numRows
'Construct the sizes listing
strSql = "EXEC usp_ac_ProductsRelated @ProductID=" & intProductID
Set rsRelatedProd = Server.CreateObject("ADODB.Recordset")
rsRelatedProd.Open strSql, Conn
rsRelatedProd_numRows = 0
%>
<%
'__________________________________________________________________________________________________
End If ' End If intProductID is not empty
%>
<%
Dim HLooper1__numRows
HLooper1__numRows = -6
Dim HLooper1__index
HLooper1__index = 0
rsColor_numRows = rsColor_numRows + HLooper1__numRows
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsRelatedProd_numRows = rsRelatedProd_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Add item to UC Shopping cart
UC_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
UC_editAction = UC_editAction & "?" & Request.QueryString
End If
UC_recordId = CStr(Request.Form("UC_recordId"))
If (Request.Form("UC_recordId").Count = 1) Then
set UC_rs=rsProduct
UC_uniqueCol="ProductID"
UC_redirectPage = "cart.asp"
If (NOT (UC_rs is Nothing)) Then
' Position recordset to correct location
If (UC_rs.Fields.Item(UC_uniqueCol).Value <> UC_recordId) Then
' reset the cursor to the beginning
If (UC_rs.CursorType > 0) Then
If (Not UC_rs.BOF) Then UC_rs.MoveFirst
Else
UC_rs.Close
UC_rs.Open
End If
Do While (Not UC_rs.EOF)
If (Cstr(UC_rs.Fields.Item(UC_uniqueCol).Value) = UC_recordId) Then
Exit Do
End If
UC_rs.MoveNext
Loop
End If
End If
UC_BindingTypes=Array("RS","FORM","RS","FORM","FORM","FORM","NONE","RS","FORM","NONE")
UC_BindingValues=Array("ProductID","qty","ProductName","option","color","size","","Weight","Price","")
UCCart1.AddItem UC_rs,UC_BindingTypes,UC_BindingValues,"increment"
' redirect with URL parameters
If (UC_redirectPage <> "") Then
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
UC_redirectPage = UC_redirectPage & "?" & Request.QueryString
End If
Call Response.Redirect(UC_redirectPage)
End If
End If
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
Adha Zelma
<%
If errMsg <> "" Then 'If error message is not empty, don't write product tables
%>
<%=errMsg %>
<%
Else 'If all is well, write the product tables
%>
<%
'**** Need to check stock level and deliver appropriate message
If rsProduct("currentLevel") < rsProduct("lowStockLevel") Then
Response.Write "" & rsProduct("lowStockMsg") & "
"
End If
'**** End of stock message
%>
<% If Len(rsProduct("SalePrice")) = 0 OR rsProduct("SalePrice") = "" OR isNull(rsProduct("SalePrice")) Then %>
Price: <%= FormatCurrency((rsProduct.Fields.Item("UnitPrice").Value), 2, -2, -2, -2) %>
<% Else %>
Price: <%= FormatCurrency((rsProduct.Fields.Item("UnitPrice").Value), 2, -2, -2, -2) %> Sale Price: <%= FormatCurrency((rsProduct.Fields.Item("SalePrice").Value), 2, -2, -2, -2) %>
<% End If %>
<%=(rsProduct.Fields.Item("ProductCode").Value)%>
<%
While ((startrw <= endrw) AND (Not rsColor.EOF))
%>
<% If rsColor("ColorSwatch") <> "" Then %>
" alt="<%=(rsColor.Fields.Item("ProductColor").Value)%>" name="swatch" width="20" height="23" hspace="0" vspace="0" border="1">
<% End If %>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsRelatedProd.MoveNext()
Wend
%>
<% End If ' end Not rsRelatedProd.EOF Or NOT rsRelatedProd.BOF %>
<% End If 'End If error message is not empty %>
<%
If len(intProductID) <> 0 Then
%>
<%
rsProduct.Close()
Set rsProduct = Nothing
%>
<%
rsColor.Close()
Set rsColor = Nothing
%>
<%
rsSize.Close()
Set rsSize = Nothing
%>
<%
rsRelatedProd.Close()
Set rsRelatedProd = Nothing
%>
<%
rsOption.Close()
Set rsOption = Nothing
%>
<%
End If
%>
<%
Conn.Close()
Set Conn = Nothing
%>