Hi
I want to add a simple search facility to a shopping cart ( a.shopkart 2.0) and also a price filter, could anyone help please. This is the page that the search and fiter would go to display the products. Thanks
<!-- #include file="db.asp" -->
<%
Response.Buffer = true
Dim catid, strcat
catid = Request.QueryString("id")
strcat = Request.QueryString ("cat")
If catid = "" OR (IsNumeric(catid) = false) Then
Response.Redirect "default.asp"
End if
Dim catname, productslist
sub productInfo(connObj,category)
q = chr(34)
set cmd = server.CreateObject("ADODB.Command")
cmd.ActiveConnection = connObj
cmd.CommandText = "qryProdsCategory"
cmd.CommandType = adCmdStoredProc
set param = cmd.CreateParameter("theCategory",adInteger,adParamInput,4)
cmd.Parameters.Append(param)
cmd("theCategory") = Cint(category)
set rs = server.CreateObject("ADODB.Recordset")
set rs = cmd.Execute
if not rs.EOF then
catname = rs("catdescription")
strHTML = "<table border=0 cellPadding=4 cellSpacing=2 width='100%'>"
strHTML = strHTML & "<tr>"
i = 1
while not rs.EOF
strHTML = strHTML & "<td valign=top>" & vbcrlf
strHTML = strHTML & "<img src=" & q& "images/" & rs("cimageurl") &q& " align=" & q& "left"& q & ">" & vbcrlf
'strHTML = strHTML & "<img src=" & q& "images/small/" & rs("cimageurl") &q& " align=" & q& "left"& q & ">" & vbcrlf
strHTML = strHTML & "<h4>" & rs("cname") & "</h4>" & vbcrlf
'strHTML = strHTML & "<p><font size=-1><a href="&q&"product.asp?id=" & rs("catalogID") &q&">More</a></font></p>" & vbcrlf
strHTML = strHTML & "<p><font size=-1><a href="&q&"product.asp?id=" & rs("catalogID") &q&"><img src='.\images\more.jpg" & " '></a></font></p>" & vbcrlf
strHTML = strHTML & "<p>Price: " & FormatCurrency(rs("cprice"),2) & "<br>" & vbcrlf
strHTML = strHTML & "<form action="&q&"addprod.asp"&q&" method="&q&"POST"&q&" name=form"&i&" onSubmit="&q& "return checkItems(form"&i&")" & q&">" & vbcrlf
strHTML = strHTML & "<input type="&q&"hidden"&q&" name="&q&"fproductid"&q&" value="&q & rs("catalogID")& q&">" & vbcrlf
strHTML = strHTML & "Quantity: <input maxLength="&q&"1"&q&" name="&q&"fquantity"&q&" size=2 value="&q&"1"&q&">" & vbcrlf
strHTML = strHTML & "<input type="&q&"submit"&q&" value="&q&"ORDER"&q&" name="&q&"order"&q&" style="&q&"font-family: Arial; color: #800000; font-weight: bold"&q&">"
strHTML = strHTML & "</form></td>" & vbcrlf
if (i mod 2) = 0 then
strHTML = strHTML & "</tr><tr>" & vbcrlf
end if
i = i + 1
rs.MoveNext
wend
strHTML = strHTML & "<tr></table>"
else
strHTML = "Product information not found."
catname = "Error"
end if
productslist = strHTML
rs.Close
set rs = nothing
set cmd = nothing
end sub
%>
<html>
<head>
<title>Products</title>
<SCRIPT LANGUAGE=javascript>
<!--
function checkItems(formobj)
{
var quant = formobj.fquantity.value
if (isNaN(quant) == true || quant < 1 || quant > 9)
{
alert("Please enter a number between 1 and 9");
formobj.fquantity.focus();
return false
}else
{
return true;
}
}
//-->
</SCRIPT>
<link rel="stylesheet" type="text/css" href="eposter.css">
</head>
<body bgcolor="#000000" text="#FF8000" link="#00FF00" vlink="#00FF00" alink="#00FF00">
<table border="0" width="600" cellpadding="4">
<tr>
<td width="100%" colspan="2" valign="top">
<h3><img src="images/fit net 2.jpg" alt="Fit net " width="150" height="100">
<br><font face="Arial">
<%
'on error resume next
call openConn()
if dbc.errors.count > 0 then
Response.Write "Error accessing database."
else
call productInfo(dbc,catid)
end if
call closeConn()
response.write catname
%>
</font></h3></td>
</tr>
<tr>
<td width="120"></td>
<td width="480">
<%= productslist %>
</td>
</tr>
</table>
</body>
</html>
I want to add a simple search facility to a shopping cart ( a.shopkart 2.0) and also a price filter, could anyone help please. This is the page that the search and fiter would go to display the products. Thanks
<!-- #include file="db.asp" -->
<%
Response.Buffer = true
Dim catid, strcat
catid = Request.QueryString("id")
strcat = Request.QueryString ("cat")
If catid = "" OR (IsNumeric(catid) = false) Then
Response.Redirect "default.asp"
End if
Dim catname, productslist
sub productInfo(connObj,category)
q = chr(34)
set cmd = server.CreateObject("ADODB.Command")
cmd.ActiveConnection = connObj
cmd.CommandText = "qryProdsCategory"
cmd.CommandType = adCmdStoredProc
set param = cmd.CreateParameter("theCategory",adInteger,adParamInput,4)
cmd.Parameters.Append(param)
cmd("theCategory") = Cint(category)
set rs = server.CreateObject("ADODB.Recordset")
set rs = cmd.Execute
if not rs.EOF then
catname = rs("catdescription")
strHTML = "<table border=0 cellPadding=4 cellSpacing=2 width='100%'>"
strHTML = strHTML & "<tr>"
i = 1
while not rs.EOF
strHTML = strHTML & "<td valign=top>" & vbcrlf
strHTML = strHTML & "<img src=" & q& "images/" & rs("cimageurl") &q& " align=" & q& "left"& q & ">" & vbcrlf
'strHTML = strHTML & "<img src=" & q& "images/small/" & rs("cimageurl") &q& " align=" & q& "left"& q & ">" & vbcrlf
strHTML = strHTML & "<h4>" & rs("cname") & "</h4>" & vbcrlf
'strHTML = strHTML & "<p><font size=-1><a href="&q&"product.asp?id=" & rs("catalogID") &q&">More</a></font></p>" & vbcrlf
strHTML = strHTML & "<p><font size=-1><a href="&q&"product.asp?id=" & rs("catalogID") &q&"><img src='.\images\more.jpg" & " '></a></font></p>" & vbcrlf
strHTML = strHTML & "<p>Price: " & FormatCurrency(rs("cprice"),2) & "<br>" & vbcrlf
strHTML = strHTML & "<form action="&q&"addprod.asp"&q&" method="&q&"POST"&q&" name=form"&i&" onSubmit="&q& "return checkItems(form"&i&")" & q&">" & vbcrlf
strHTML = strHTML & "<input type="&q&"hidden"&q&" name="&q&"fproductid"&q&" value="&q & rs("catalogID")& q&">" & vbcrlf
strHTML = strHTML & "Quantity: <input maxLength="&q&"1"&q&" name="&q&"fquantity"&q&" size=2 value="&q&"1"&q&">" & vbcrlf
strHTML = strHTML & "<input type="&q&"submit"&q&" value="&q&"ORDER"&q&" name="&q&"order"&q&" style="&q&"font-family: Arial; color: #800000; font-weight: bold"&q&">"
strHTML = strHTML & "</form></td>" & vbcrlf
if (i mod 2) = 0 then
strHTML = strHTML & "</tr><tr>" & vbcrlf
end if
i = i + 1
rs.MoveNext
wend
strHTML = strHTML & "<tr></table>"
else
strHTML = "Product information not found."
catname = "Error"
end if
productslist = strHTML
rs.Close
set rs = nothing
set cmd = nothing
end sub
%>
<html>
<head>
<title>Products</title>
<SCRIPT LANGUAGE=javascript>
<!--
function checkItems(formobj)
{
var quant = formobj.fquantity.value
if (isNaN(quant) == true || quant < 1 || quant > 9)
{
alert("Please enter a number between 1 and 9");
formobj.fquantity.focus();
return false
}else
{
return true;
}
}
//-->
</SCRIPT>
<link rel="stylesheet" type="text/css" href="eposter.css">
</head>
<body bgcolor="#000000" text="#FF8000" link="#00FF00" vlink="#00FF00" alink="#00FF00">
<table border="0" width="600" cellpadding="4">
<tr>
<td width="100%" colspan="2" valign="top">
<h3><img src="images/fit net 2.jpg" alt="Fit net " width="150" height="100">
<br><font face="Arial">
<%
'on error resume next
call openConn()
if dbc.errors.count > 0 then
Response.Write "Error accessing database."
else
call productInfo(dbc,catid)
end if
call closeConn()
response.write catname
%>
</font></h3></td>
</tr>
<tr>
<td width="120"></td>
<td width="480">
<%= productslist %>
</td>
</tr>
</table>
</body>
</html>