I have been working on an e-commerce site and i would like to give some customers different prices for products. so im trying to figure out the best way to do this.
i dont want to add extra columns for each product in the customers table because i want to be able to add and delete products eazy. so im thinking maybe have another table called product_prices. This table would not be used for everyone, but if the customer is logged in, then it will check before each price is displayed to see if they have that product at a better price. so here is kinda how the table would be laid out.
price_id = unique id
customer_id = customers user number
product_id = products_id
customer_price = price the customer gets it at.
so then i could basically do a sql string like this...
<%
strSql = "SELECT customer_price"
strSql = strSql & " FROM product_prices"
strSql = strSql & " WHERE customer_id='" & SQLencode(strCookieCustomerID) & "'"
strSql = strSql & " AND product_id='" & SQLencode(strProductID) & "'"
set rs = my_Conn.Execute (strSql)
if rs.eof or rs.bof then
strProductPrice = strOldProductPrice
else
strProductPrice = rs("customer_price")
end if
Response.Write "This product will cost you " & strProductPrice & "!"
%>
Brad
Edited by - redbrad0 on 25 May 2001 09:05:24