% '----------General section------------ CURRENT_VERSION = ("2001") CURRENT_STYLE = ("../ECStyle.css") FormAction = ("AddToShoppingCart.asp") ScriptRelativeFolder = ("WebStore") pos=InstrRev(LCase(Request.ServerVariables("PATH_TRANSLATED")),LCase(ScriptRelativeFolder) & "\" & LCase(FormAction)) BS_Root = Left(Request.ServerVariables("PATH_TRANSLATED"), pos-1 ) DB_Path =BS_Root & "\" ScriptFolderAddress =BS_Root & "\" & ScriptRelativeFolder & "\" URL =Request.ServerVariables("URL") SERVER_NAME=Request.ServerVariables("SERVER_NAME") SERVER_NAME="http://"&SERVER_NAME&URL ScriptRelativeFolder = ("WebStore") pos=InstrRev(LCase(SERVER_NAME),LCase(ScriptRelativeFolder) & "/" & LCase(FormAction)) BS_Root_URL = Left(SERVER_NAME, pos-1) BS_Root_URL = BS_Root_URL & "/" bHeaderFired = FALSE '==========Constants============= '---- CursorTypeEnum Values ---- Const adOpenForwardOnly = 0 Const adOpenKeyset = 1 Const adOpenDynamic = 2 Const adOpenStatic = 3 '---- LockTypeEnum Values ---- Const adLockReadOnly = 1 Const adLockPessimistic = 2 Const adLockOptimistic = 3 Const adLockBatchOptimistic = 4 '=========End of Section=========== '----------Parameters section------------ if Request("VisID")= "" Then Parameter_64 = "" 'Default value else Parameter_64 = Request("VisID") end if if Request("ProductID")= "" Then Parameter_65 = "" 'Default value else Parameter_65 = Request("ProductID") end if '----------Variables section------------ Dim VarArray(10,0) VarNum = 11 'Initialization of Vars Variable_76 = "0" 'Initial value Variable_78 = "0" 'Initial value Variable_110 = "Recalculate" 'Initial value Variable_114 = "checkbox" 'Initial value Variable_115 = "editbox" 'Initial value Variable_102 = "0" 'Initial value Variable_126 = "" 'Initial value Variable_781 = "WS_VisitorID" 'Initial value Variable_782 = "" 'Initial value Variable_863 = "" 'Initial value Variable_513 = "" 'Initial value 'Subroutins and functions Sub PushVars() VarArray(0,0)=Variable_76 VarArray(1,0)=Variable_78 VarArray(2,0)=Variable_110 VarArray(3,0)=Variable_114 VarArray(4,0)=Variable_115 VarArray(5,0)=Variable_102 VarArray(6,0)=Variable_126 VarArray(7,0)=Variable_781 VarArray(8,0)=Variable_782 VarArray(9,0)=Variable_863 VarArray(10,0)=Variable_513 end sub Sub PopVars() end sub Sub RestoreVars() Variable_76=VarArray(0,0) Variable_78=VarArray(1,0) Variable_110=VarArray(2,0) Variable_114=VarArray(3,0) Variable_115=VarArray(4,0) Variable_102=VarArray(5,0) Variable_126=VarArray(6,0) Variable_781=VarArray(7,0) Variable_782=VarArray(8,0) Variable_863=VarArray(9,0) Variable_513=VarArray(10,0) end sub '----------Cookie section------------ if Request.Cookies("WS_Visitors_99")("WS_VisitorID")= "" Then Cookie_66 = "" 'Empty else Cookie_66 = Request.Cookies("WS_Visitors_99")("WS_VisitorID") end if 'Functions that in the future should be placed in stanalone .INC File 'Function to format date string Function format_date(date,dataformat) months =Array("January","February","March","April","May","June","July","August","September","October","November","December") mon = Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") 'dd-MMM-yyyy = 0 'MM/dd/yyyy = 1 'dd MMMM,yyyy = 2 'MMMM dd,yyyy = 3 daypart = Day(date) monthpart = Month(date) yearpart = Year(date) monthpart = monthpart -1 if(dataformat = 0) then format_date = daypart & " " & mon(monthpart) & "," & yearpart end if if(dataformat = 1) then format_date = monthpart & "-" & daypart & "-" & yearpart end if if(dataformat = 2) then format_date = daypart & " " & months(monthpart) & "," & yearpart end if if(dataformat = 3) then format_date = months(monthpart) & " " & daypart & "," & yearpart end if end Function 'Function to format time string Function format_time(date,dataformat) hourpart = Hour(date) minutepart = Minute(date) secondpart = Second(date) format_time = hourpart & ":" & minutepart & ":" & secondpart end Function '----------Start Algorithm section------------ %> <% '==============Query_65("shopDB")================ DataSource1 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ= "& DB_Path &"WebStore/Databases/ShopDB.mdb;" PageSize1 = 1 GeneratedSQL= "SELECT CompanyInfo.MerchantID as QueryOutput_773"_ &" FROM CompanyInfo" %> <%'===============Execute Query And Get Total Count======================== Set Conn1 = Server.CreateObject("ADODB.Connection") Set RS1 = Server.CreateObject("ADODB.RecordSet") RS1.CursorType = adOpenStatic Conn1.Open DataSource1 RS1.Open GeneratedSQL,Conn1,adOpenKeyset,adLockReadOnly 'both keys are to be variables TotalCount1=RS1.RecordCount RS1.PageSize = PageSize1 'Number of rows per page ScrollAction = Request("_NavAction1") if ScrollAction <> "" Then PageNo1 = mid(ScrollAction, 5) if PageNo1 < 1 Then PageNo1 = 1 end if else PageNo1 = 1 end if 'set the page number on which the current record is located. if(TotalCount1 <> 0) then RS1.AbsolutePage = PageNo1 'Page Number end if FromRec1=(PageNo1-1)*PageSize1 +1 if PageNo1*PageSize1 > TotalCount1 Then ToRec1 = TotalCount1 else ToRec1 = PageNo1*PageSize1 end if URLTail1 = "&VisID="& Parameter_64 &"&ProductID="& Parameter_65 FNavAhead1 = "Next" FNavBack1 = "Previous" FLinkAhead1 = FormAction & "?_NavAction1=Page" & (PageNo1+1)& URLTail1 FLinkBack1 = FormAction & "?_NavAction1=Page" & (PageNo1-1)& URLTail1 %><%RowCount1 = rs1.PageSize CurrentRecordNumber1 = 0 bSetBegin1 = TRUE Do While Not RS1.EOF and rowcount1 > 0 QueryOutput_773 = rs1.fields("QueryOutput_773") %><%Variable_781=Variable_781&QueryOutput_773%> <%'----------------End Repetition Section------------------------------- RowCount1 = RowCount1 - 1 CurrentRecordNumber1 = CurrentRecordNumber1 + 1 RS1.MoveNext Loop %><% Conn1.Close set rs1 = nothing set Conn1 = nothing %> <%Variable_782 = Request.Cookies("WS_Visitors_99")(Variable_781) %><%if(Variable_782 = "") Then%> <%Response.Redirect "CookieMessage.asp"%><%else%> <%end if%><%if(Parameter_65 = "") Then%> <%Variable_126=Variable_782%> <%else%> <% '==============Query_14("shopDB")================ DataSource3 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ= "& DB_Path &"WebStore/Databases/ShopDB.mdb;" PageSize3 = 1 GeneratedSQL= "SELECT Basket.ProdID as QueryOutput_108,Basket.Quantity as QueryOutput_109,Basket.VisID as QueryOutput_118"_ &" FROM Basket"_ &" WHERE Basket.ProdID = "&Parameter_65&" AND Basket.VisID = "&Variable_782&"" %> <%'===============Execute Query And Get Total Count======================== Set Conn3 = Server.CreateObject("ADODB.Connection") Set RS3 = Server.CreateObject("ADODB.RecordSet") RS3.CursorType = adOpenStatic Conn3.Open DataSource3 RS3.Open GeneratedSQL,Conn3,adOpenKeyset,adLockReadOnly 'both keys are to be variables TotalCount3=RS3.RecordCount RS3.PageSize = PageSize3 'Number of rows per page ScrollAction = Request("_NavAction3") if ScrollAction <> "" Then PageNo3 = mid(ScrollAction, 5) if PageNo3 < 1 Then PageNo3 = 1 end if else PageNo3 = 1 end if 'set the page number on which the current record is located. if(TotalCount3 <> 0) then RS3.AbsolutePage = PageNo3 'Page Number end if FromRec3=(PageNo3-1)*PageSize3 +1 if PageNo3*PageSize3 > TotalCount3 Then ToRec3 = TotalCount3 else ToRec3 = PageNo3*PageSize3 end if URLTail3 = "&VisID="& Parameter_64 &"&ProductID="& Parameter_65 FNavAhead3 = "Next" FNavBack3 = "Previous" FLinkAhead3 = FormAction & "?_NavAction3=Page" & (PageNo3+1)& URLTail3 FLinkBack3 = FormAction & "?_NavAction3=Page" & (PageNo3-1)& URLTail3 %><%if(TotalCount3 = "0") Then%> <%Variable_102="1"%> <%else%> <%end if%><% Conn3.Close set rs3 = nothing set Conn3 = nothing %> <%Variable_126=Parameter_64%> <%end if%><%if(Variable_102 = "1") Then%> <% '==============Query_8("shopDB")================ DataSource3 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ= "& DB_Path &"WebStore/Databases/ShopDB.mdb;" PageSize3 = 1 GeneratedSQL= "INSERT INTO Basket(Quantity,ProdID,VisID)"_ &" VALUES (1,"&Parameter_65&","&Variable_782&")" %> <%'===============Execute Query And Get Total Count======================== Set Conn3 = Server.CreateObject("ADODB.Connection") Set RS3 = Server.CreateObject("ADODB.RecordSet") RS3.CursorType = adOpenStatic Conn3.Open DataSource3 RS3.Open GeneratedSQL,Conn3,adOpenKeyset,adLockReadOnly 'both keys are to be variables %><% Conn3.Close set rs3 = nothing set Conn3 = nothing %> <%else%> <%end if%><% '==============Query_67("shopDB")================ DataSource1 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ= "& DB_Path &"WebStore/Databases/ShopDB.mdb;" PageSize1 = 1 GeneratedSQL= "SELECT Basket.ProdID as QueryOutput_720,Basket.Quantity as QueryOutput_721,Basket.VisID as QueryOutput_722,Products.ProductID as QueryOutput_723,Products.UnitPrice as QueryOutput_724"_ &" FROM Basket,Products"_ &" WHERE Basket.ProdID = Products.ProductID AND Basket.VisID = "&Variable_782&"" %> <%'===============Execute Query And Get Total Count======================== Set Conn1 = Server.CreateObject("ADODB.Connection") Set RS1 = Server.CreateObject("ADODB.RecordSet") RS1.CursorType = adOpenStatic Conn1.Open DataSource1 RS1.Open GeneratedSQL,Conn1,adOpenKeyset,adLockReadOnly 'both keys are to be variables TotalCount1=RS1.RecordCount if(TotalCount1 > 0) then RS1.PageSize = TotalCount1 'All records PageSize1 = TotalCount1 'All records end if ScrollAction = Request("_NavAction1") if ScrollAction <> "" Then PageNo1 = mid(ScrollAction, 5) if PageNo1 < 1 Then PageNo1 = 1 end if else PageNo1 = 1 end if 'set the page number on which the current record is located. if(TotalCount1 <> 0) then RS1.AbsolutePage = PageNo1 'Page Number end if FromRec1=(PageNo1-1)*PageSize1 +1 if PageNo1*PageSize1 > TotalCount1 Then ToRec1 = TotalCount1 else ToRec1 = PageNo1*PageSize1 end if URLTail1 = "&VisID="& Parameter_64 &"&ProductID="& Parameter_65 FNavAhead1 = "Next" FNavBack1 = "Previous" FLinkAhead1 = FormAction & "?_NavAction1=Page" & (PageNo1+1)& URLTail1 FLinkBack1 = FormAction & "?_NavAction1=Page" & (PageNo1-1)& URLTail1 %><%RowCount1 = rs1.PageSize CurrentRecordNumber1 = 0 bSetBegin1 = TRUE Do While Not RS1.EOF and rowcount1 > 0 QueryOutput_720 = rs1.fields("QueryOutput_720") QueryOutput_721 = rs1.fields("QueryOutput_721") QueryOutput_722 = rs1.fields("QueryOutput_722") QueryOutput_723 = rs1.fields("QueryOutput_723") QueryOutput_724 = rs1.fields("QueryOutput_724") %><%Variable_78=QueryOutput_724%> <%Variable_78=Variable_78*QueryOutput_721%> <%Variable_76=Variable_76+Variable_78%> <%'----------------End Repetition Section------------------------------- RowCount1 = RowCount1 - 1 CurrentRecordNumber1 = CurrentRecordNumber1 + 1 RS1.MoveNext Loop %><% Conn1.Close set rs1 = nothing set Conn1 = nothing %> <%if (bHeaderFired = FALSE) then%>

<% if(CurrentRecordNumber1 =ToRec1 -FromRec1) then %> <%end if%>
<%Call PopVars()%> <%'----------------End Repetition Section------------------------------- RowCount1 = RowCount1 - 1 CurrentRecordNumber1 = CurrentRecordNumber1 + 1 RS1.MoveNext Loop %><% Conn1.Close set rs1 = nothing set Conn1 = nothing %> <%if (bHeaderFired = FALSE) then%>If you change the Confirm or Quantity columns, to update the Sub Total amount: First click on Recalculate, then click on "Refresh or Reload" icon in your browser.
Enter quantity of each product you want to buy in the Quantity column.
To remove an item from the list, deselect the confirm check box by clicking on it.
After you make any changes, click Recalculate to get the new total.
<%Call PopVars()%> <%if (bHeaderFired = TRUE) then%>