%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_theretreat_STRING
MM_editCmd.CommandText = "INSERT INTO dbo.shop_basket_items (unid, product, product_id, product_price, qty, delivery_item) VALUES (?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, 255, Request.Form("unid")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 255, Request.Form("product")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, 50, Request.Form("product_id")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 5, 1, -1, MM_IIF(Request.Form("product_price"), Request.Form("product_price"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 5, 1, -1, MM_IIF(Request.Form("qty"), Request.Form("qty"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, 50, Request.Form("delivery_item")) ' adLongVarChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "#"& Request.Form("product_id")
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim Recordset1__mmsearch
Recordset1__mmsearch = "%"
If (request.querystring("search") <> "") Then
Recordset1__mmsearch = request.querystring("search")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_theretreat_STRING
Recordset1_cmd.CommandText = "SELECT * FROM dbo.shop_prices WHERE pr_title LIKE ? ORDER BY Expr9, running_odr, sub_s_ID, running_order"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 200, 1, 255, "%" + Recordset1__mmsearch + "%") ' adVarChar
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Recordset2__mmid
Recordset2__mmid = "0"
If (session("basket_id") <> "") Then
Recordset2__mmid = session("basket_id")
End If
%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows
Set Recordset2_cmd = Server.CreateObject ("ADODB.Command")
Recordset2_cmd.ActiveConnection = MM_theretreat_STRING
Recordset2_cmd.CommandText = "SELECT * FROM dbo.shop_basket_items WHERE unid=? AND qty>0"
Recordset2_cmd.Prepared = true
Recordset2_cmd.Parameters.Append Recordset2_cmd.CreateParameter("param1", 200, 1, 255, Recordset2__mmid) ' adVarChar
Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset2_total
Dim Recordset2_first
Dim Recordset2_last
' set the record count
Recordset2_total = Recordset2.RecordCount
' set the number of rows displayed on this page
If (Recordset2_numRows < 0) Then
Recordset2_numRows = Recordset2_total
Elseif (Recordset2_numRows = 0) Then
Recordset2_numRows = 1
End If
' set the first and last displayed record
Recordset2_first = 1
Recordset2_last = Recordset2_first + Recordset2_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset2_total <> -1) Then
If (Recordset2_first > Recordset2_total) Then
Recordset2_first = Recordset2_total
End If
If (Recordset2_last > Recordset2_total) Then
Recordset2_last = Recordset2_total
End If
If (Recordset2_numRows > Recordset2_total) Then
Recordset2_numRows = Recordset2_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (Recordset2_total = -1) Then
' count the total records by iterating through the recordset
Recordset2_total=0
While (Not Recordset2.EOF)
Recordset2_total = Recordset2_total + 1
Recordset2.MoveNext
Wend
' reset the cursor to the beginning
If (Recordset2.CursorType > 0) Then
Recordset2.MoveFirst
Else
Recordset2.Requery
End If
' set the number of rows displayed on this page
If (Recordset2_numRows < 0 Or Recordset2_numRows > Recordset2_total) Then
Recordset2_numRows = Recordset2_total
End If
' set the first and last displayed record
Recordset2_first = 1
Recordset2_last = Recordset2_first + Recordset2_numRows - 1
If (Recordset2_first > Recordset2_total) Then
Recordset2_first = Recordset2_total
End If
If (Recordset2_last > Recordset2_total) Then
Recordset2_last = Recordset2_total
End If
End If
%>
Free delivery on orders over £50 & EMAILED VOUCHERS
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<%section=0 %>
<%sub_section=0 %>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<% If not (Recordset1.Fields.Item("sect_title").Value)=section Then %>
<%=(Recordset1.Fields.Item("sect_title").Value)%>
<%=(Recordset1.Fields.Item("sect_des").Value)%>
<% End If %>
<%section=(Recordset1.Fields.Item("sect_title").Value) %>
<% If not (Recordset1.Fields.Item("sub_sect_title").Value)=sub_section Then %>