if request.cookies("snsn")("username")="" then
response.write "alert('对不起,您还没有登录!');window.close();"
response.End
end if
username=request.cookies("snsn")("username")
shopid=request("shopid")
if shopid="" then
response.write "alert('对不起,您没有选择商品!');window.close();"
response.End
end if
Set rs_s=Server.CreateObject("Adodb.RecordSet")
rs_s.Open "Select * from shop_snsn where shopid in ("&shopid&")",Conn,3,3
while not rs_s.eof
if request.Cookies("snsn")("reglx")=2 then
danjia=rs_s("vipjia")
else
danjia=rs_s("huiyuanjia")
end if
kucun=rs_s("kucun")
shopname=rs_s("shopname")
if kucun response.write "alert('你选购的商品“"&shopname&"”暂时缺货不能放到购物车里,请选购其他商品!');window.close();"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_action where username='"&username&"' and shopid="&trim(rs_s("shopid"))&" and zhuangtai=7",conn,1,3
if rs.recordcount=1 then
'//修改数量
if kucun response.write "alert('你选购的商品“"&shopname&"”暂时缺货不能放到购物车里,请选购其他商品!');window.close();"
response.end
end if
rs("zonger")=(rs("shopcount")+1)*danjia
rs("shopcount")=rs("shopcount")+1
rs.update
rs.close
set rs=nothing
else
'//添加购物
rs.close
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_action",conn,1,3
rs.addnew
rs("shopid")=trim(rs_s("shopid"))
rs("username")=username
rs("zhuangtai")=7
rs("shopcount")=1
rs("zonger")=danjia
rs.update
rs.close
set rs=nothing
end if
rs_s.movenext
wend
rs_s.close
set rs_s=nothing
response.Redirect "gouwu.asp?action=show"
%>