I need your expert help on this code please.
As par of my ecommerce solution, I needed to add a shopping cart functionality that, among other things, add item to the cart, determines quantity, unit price, total price, etc.
So far,the code below does that nicely.
Problem is, the client I am doing this work for has 3 different price listings.
For instance, for t-shirt, and I am using t-shirt as an example here, if a customer wants to order a t-shirt, s/he can pay either $10, $25 or $22 depending on which group he or she belongs to.
Example, here sample price groupings:
Product Code AIP Price 1-10 Price 10 and Up price
sp387 $29 $34 $27
ep233 $19 $24 $17
dn987 $39 $44 $37
From the sample example above, we can see that if an individual belongs to a group called AIP
and wishes to puchase items with product codes sp387, ep233, dn987, s/he will pay 29, 19, 39 respestively.
If the customer wishes to purchase items with same product codes, but don't belong to AIP and wishes to purchase items that are less than 10 in quantity, they pay 34, 24, 44 and if the customers wishes to purchase items with those product numbers with quanities greater than 10, the users pays 27, 17, 37 respectively.
Can I ask someone to show me how to modify this code to give a customer the option to select a price based on the the option they selected from any of the 3 groups above.
This code has already been implemented before the client came up with these new pricing guidelines.
Since I already have one field called price on the database.
I thought about adding 2 new fields, one called 10PlusqtyPrice (for purchases of 10 or more products) and AIPPrice (For customers who may belong to AIP).
The price field already on the db will represent purchases of less than 10 products.
How to go about coding this so that when a customer adds a product to cart, the app determines the price based on any of the ranges described above.
Hope this is fairly clear.
Thanks in advance.
Below is the current working code.
Response.Buffer = true
Dim catid, strcat
catid = Request.QueryString("id")
strcat = Request.QueryString ("cat")
If catid = "" OR (IsNumeric(catid) = false) Then
Response.Redirect "home.asp"
End if
Dim catname, productslist
sub productInfo(connObj,catego
ry)
q = chr(34)
set cmd = server.CreateObject("ADODB
.Command")
cmd.ActiveConnection = connObj
cmd.CommandText = "qryProdsCategory"
cmd.CommandType = adCmdStoredProc
set param = cmd.CreateParameter("theCa
tegory",ad
Integer,ad
ParamInput
,4)
cmd.Parameters.Append(para
m)
cmd("theCategory") = Cint(category)
set rs = server.CreateObject("ADODB
.Recordset
")
set rs = cmd.Execute
if not rs.EOF then
catname = rs("catdescription")
strHTML = "<table width='100%' border=0 cellspacing=0 cellpadding=0>"
strHTML = strHTML & "<tr>"
i = 1
while not rs.EOF
strHTML = strHTML & "<td class=bodytextcolor width='33%' align=center>" & vbcrlf
strHTML = strHTML & "<br><img src=" & q& "img/small/" & rs("cimageurl") &q& " align=" & q& "center"& q & " WIDTH='97' HEIGHT='125'>" & vbcrlf
strHTML = strHTML & "<br>" & rs("cname") & " " & vbcrlf
strHTML = strHTML & "<br>Price: " & FormatCurrency(rs("cprice"
),2) & "" & vbcrlf
strHTML = strHTML & "<br><font size=-1><a href="&q&"product.asp?id="
& rs("catalogID") &q&">View Details</a></font>" & vbcrlf & 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&"6"&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 3) = 0 then
strHTML = strHTML & "</td></tr>" & vbcrlf
end if
i = i + 1
rs.MoveNext
wend
strHTML = strHTML & ""
else
strHTML = "Product information not found."
catname = "Error"
end if
productslist = strHTML
rs.Close
set rs = nothing
set cmd = nothing
end sub
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="25">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td width="100%" colspan="3" align="center" class="body">
<strong>Here are the Millennium Healthcare Products we carry:</strong><br>
Click the link to see details on the product.
</td>
</tr>
<tr>
<td colspan="3" class="bodytextcolor">
<strong>
<%
'on error resume next
call openConn()
call productInfo(dbc,catid)
call closeConn()
response.write catname
%>
</strong>
</td>
</tr>
<!-- -->
<tr>
<td width="33%" class="bodytextcolor" align="center">
<%= productslist %>
</td>
</tr>
</table>