<%Response.Expires=0%> <% Dim productid,action dim dgsp 'dgsp=trim(request("dgsp"))'代购 dgsp=0 'productid=clng(Request("productid")) MyAction=trim(Request("action")) productid=trim(Request("productid")) if IsNull(productid) or productid="" or productid<1 or isnull(productid) or MyAction<>"add" then response.write " 请不要非法操作,你的计算机信息我们已保留。" response.end end if If productSaleJifen(productid)<>0 then Session("duihuanProductID")=Request("ProductID") If Session("keyongjifen") - productSaleJifen(productid)<0 then 'If productSaleJifen(productid) - request.Cookies("keyongjifen")>0 then response.write "抱歉,您的可用积分不够!!
或者您还没有登陆!
" response.Write Session("keyongjifen") Response.end End if ' End If function quehuo(id) Dim str,rs,sql set rs = server.CreateObject("Adodb.Recordset") sql = "select saletype from product where id="&id rs.open sql,conn,1,1 if rs.eof then str = "4" else str = rs("saletype") end if if instr(str,"4")>0 or instr(str,"6")>0 then str="1" else str="0" end if rs.close set rs = nothing quehuo = str end function if quehuo(productid)="1" then response.write "抱歉,此商品暂时缺货!!
有需要请与我们联系 (人工服务时间:9:00am-7:00pm)
" response.end end if '=================================== '= 函数 productSaleJifen '= 功能 兑换产品需要的积分 '= 修改 jaken 2005-7-16 '= 参数 '============================= Function productSaleJifen(pid) Dim rs,sql,jj Set Rs = Server.CreateObject("Adodb.recordset") Sql = "select salejifen from product where id="&pid Rs.open sql,conn,1,1 If not rs.eof then jj = RS("salejifen") Else jj = 0 End if Rs.close Set Rs = nothing productSaleJifen = jj End Function Session("keyongjifenTemp")=Session("keyongjifenTemp")-Request("salejifen") 'cookie if session("basketid")="" or isnull(session("basketid")) then session("basketid")= Request.Cookies("jafei")("basketid") end if session("membervip")="1" memberid=session("eb_userid") if memberid="" or not isnumeric(memberid) then memberid=0 else memberid=cint(memberid) end if Dim rsJ, sqlj set rsj=server.CreateObject("ADODB.recordset") ' '***************************************************** ' '当前购物篮为空时 if session("basketid")="" or isnull(session("basketid")) then sqlstr="execute sp_CreateBasket '"&session.SessionID&"',"&memberid set myrs1=conn.execute(sqlstr) sqlj= "select max(basketid) as basketid from t_business_basket where SessionID="&session.SessionID rsj.open sqlj,conn,1,1 current_basketid=rsj("basketid") Domain_Name=Request.ServerVariables("HTTP_HOST") if Domain_Name = "www.shopabcd.com" or Domain_Name = "shopabcd.com" then Response.Cookies("jafei").Expires = Date + 60 Response.Cookies("jafei").Domain = ".shopabcd.com" Response.Cookies("jafei")("basketid") = current_basketid session("basketid")=current_basketid end if call insert_to(productid) rsj.close set rsj = nothing else current_basketid=session("basketid") set myrs_check1=server.CreateObject ("Adodb.recordset") check_sqlstr1="select count(*) as current_prod_num from t_business_basketitem where basketid=" & current_basketid & " and productid=" & productid myrs_check1.Open check_sqlstr1,conn,1,1 if myrs_check1("current_prod_num")=0 then call insert_to(productid) else call insert_to_update(productid) end if myrs_check1.Close set myrs_check1=nothing end if Response.Redirect "my_cart.asp" sub insert_to(t_productid) '空购物时插入记录 sqlstr="insert into t_business_basketitem(productname,productid,catalogid,mak_price,mem_price,vip_price,quantity,BasketId,Memberid,salejifen,tuihuo,chengben,dgsp)" sqlstr=sqlstr & "select name,id,1,price1,price2,xianshiprice,1," sqlstr=sqlstr & current_basketid &","& memberid &",salejifen,0,0,dgsp from product where id=" & t_productid &"" conn.execute sqlstr end sub sub insert_to_update(t_productid) '当购物蓝里存在该商品时,更改商品数量及总价 sqlstr="update t_business_basketitem set quantity=quantity+1 where basketid=" & current_basketid & " and productid=" & t_productid conn.execute sqlstr end sub %>