<!--#include file="conn.asp"-->
<%
shopxpacid=request("shopxpacid")
bookid=request("bookid")
if shopxpacid="" then
response.write "<script language=javascript>alert('对不起，您没有选择商品！');window.close();</script>"
response.End
end if

'for i=1 to request.form("shopxpacid").count
'if request.form("productcount")(i)<=0 then
'productcount=1
'else
'productcount=request.form("productcount")(i)
'end if
productcount=request.form("cartNum[g]["&shopxpacid&"-"&bookid&"-na]")

set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from com_books where id="&bookid,conn,1,1
danjia=rs_s("shopxphyjia")
kucun=rs_s("kucun")
shopxpptname=rs_s("titlecn")
rs_s.close
set rs_s=nothing
'response.write kucun&" fgfg  "&productcount
'response.end
if kucun<cint(productcount) then
response.write "<script language=javascript>alert('你选购的商品“"&shopxpptname&"”库存不足，不能修改数量，请选购更换其它商品！');window.location.href='shop_user.buy.asp?action=show';</script-->"
response.end
end if
conn.execute("update shopxp_action set productcount="&productcount&",zonger="&danjia*productcount&" where shopxpacid="&shopxpacid)
'next
%>



<%
if session("user_xxx_name")<>"" then
username=trim(session("user_xxx_name"))
else
	if request.Cookies("shopxp")("dingdanusername")="" then
	username=now()
	username=replace(trim(username),"-","")
	username=replace(username,"/","")
	username=replace(username,":","")
	username=replace(username," ","")
	username=username
	response.Cookies("shopxp")("dingdanusername")=username

	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from [com_user] ",conn,1,3
	rs.addnew
	rs("username")=username
	rs("niming")=1
	rs.update
	rs.close
	set rs=nothing
	
	else
	username=request.Cookies("shopxp")("dingdanusername")
	end if
end if

set rs=server.CreateObject("adodb.recordset")
	rs.open "select shopxp_action.shopxpacid,shopxp_action.shopxpptid,shopxp_action.productcount,shopxp_action.zonger,com_books.id,com_books.cid,com_books.titlecn,com_books.bookpicm,com_books.titlecn,com_books.shichangjia,com_books.shopxphyjia,com_books.shopxpvjia from com_books inner join  shopxp_action on com_books.id=shopxp_action.shopxpptid where shopxp_action.username='"&username&"' and shopxp_action.zhuangtai=9",conn,1,1 
	shuliang=rs.recordcount
	zongji=0
do while not rs.eof
zongji=zongji+rs("zonger")
rs.movenext
loop
session("S[CART_COUNT]")=shuliang
response.write "<script>cartCountBar.setText("&session("S[CART_COUNT]")&"?"&session("S[CART_COUNT]")&":0); </script>"

response.write "<span style='font-size:14px; color:#000;'>商品总额：</span><span class='totalprice price1' style='padding-right:15px;'>￥"&Formatnumber(zongji,2,-1,-1,0)&"</span>"

rs.close
set rs=nothing
%>