28,391
社区成员
发帖
与我相关
我的任务
分享
<%
set rsp2=server.createobject("adodb.recordset")
sql="select * from cart where username='"&username&"'"
rsp2.open sql,conn,1,1
sum=0
if rsp2.eof then
call ernew("亲!您的购物车是空的哦!请先把产品加入购物车!","../products.asp")
end if
%>
<%set cwc=server.CreateObject ("Adodb.RecordSet")
cwc.Source="select sum(weigth) as sum from cart where username='"&username&"'"
cwc.Open cwc.Source,conn,1,3%>
<%
for i=1 to rsp2.recordcount
%>
<%
set rsp3=server.createobject("adodb.recordset")
sql="select * from Products where id="&rsp2("pro_id")&""
rsp3.open sql,conn,1,1
%>
<ul class="ul2">
<li style="width:120px; text-align:left">
<div class="img2">
<%
if left(rsp3("img"),1)="/" then
img=".."&rsp3("img")
else
img=rsp3("img")
end if
%>
<img src="<%=img%>" width="63" height="63" style="border:none" />
</div>
</li>
<li style="width:280px; text-align:left">
<a href="../ShowProducts.asp?id=<%=rsp2("pro_id")%>" target="_blank" style="color:#7A6145">
[ <%=rsp3("title")%> ]
</a>
</li>
<li style="width:100px;"> <%=formatNumber(s_price_dan,2)%> 元</li>
<li style="width:150px;">
<form id="form1" action="" method="post">
<input name="sub" type="hidden" value="提交" />
<input name="ids" type="hidden" value="<%=rsp2("pro_id")%>" />
<input name="counts" class="counts" type="text" value="<%=rsp2("count")%>" style="width:35px; height:18px; border:1px solid #d8d8d8; text-align:center"/>
</form>
</li>
<li style="width:100px;"><%=formatNumber(s_price_dan*rsp2("count"),2)%> 元
<p style="width:28px;height:8px; padding:5px 5px 5px 20px; line-height:7px; margin:auto; clear:both; background:url(im/lajt.png) #FFFEFD left no-repeat; background-position:5px 3px; border:#F57D3D 1px solid;color:#F36400; letter-spacing:1px; border-radius:4px;margin-bottom:2px; margin-top:0px;"><a href="?del=del&del_id=<%=rsp2("pro_id")%>" style="color:#F36400;">删除</a></p></li>
</ul>
<%
sum=formatNumber(sum+s_price_dan*rsp2("count"),2)
rsp2.movenext
next
%>
<%
if request.Form("sub")="提交" then
if request.Form("counts")=0 then
counts=1
else
counts=request.Form("counts")
end if
conn.execute "update cart set count="&counts&" where pro_id in ("&request.Form("ids")&") order by pro_id"
response.Redirect "cart.asp"
end if
%> <!--加入购物车之后变更数量触发-->