asp购物车重复加入产品

来源:百度知道 编辑:UC知道 时间:2024/06/28 05:10:12
<%
Sub PutToShopBag( Prodid, ProductList )
If Len(ProductList) = 0 Then
ProductList = "'" & Prodid & "'"
ElseIf InStr( ProductList, Prodid ) <= 0 Then
ProductList = ProductList & ", '" & Prodid & "'"
End If
End Sub
%>
<%
ProductList = Session("ProductList")
Products = Split(Request("Product_Id"), ",")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList

If Session("UserName")<>"" Then
Response.Redirect"order_check.asp"
Else
%>

这个是购物车不能重复添加同一个产品
要是添加同一个怎么做呢?
谢谢大家
sqlc="select * from Product where Product_Id in ("&productlist&") order by Product_Id"

按你的方法做还是不能
要不你给我邮箱我发给你看看可以吗?

If Len(ProductList) = 0 Then
ProductList = "'" & Prodid & "'"
ElseIf InStr( ProductList, Prodid ) <= 0 Then
ProductList = ProductList & ", '" & Prodid & "'"
End If
对不起改错了,没注意,应该是
If Len(ProductList) = 0 Then
ProductList = "'" & Prodid & "'"
Else
ProductList = ProductList & ", '" & Prodid & "'"
End If

那就没有道理了
是不是其他地方还有过滤的地方
你这样,找个地方输出Session("ProductList") 看看里面有没有重复的
如果没有,说明是这里还有过滤
如果有,可能是显示购物车的地方过滤了重复

能否添加同一个是在这个方法里做的---->PutToShopBag 你给出的代码没这个功能.

-------看错,楼下的正解.