| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2031 人关注过本帖
标题:[ 求助 SOS ] 一个难搞的购物车问题,(附上源代码,可提供数据库)
只看楼主 加入收藏
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
结帖率:50%
收藏
 问题点数:0 回复次数:7 
[ 求助 SOS ] 一个难搞的购物车问题,(附上源代码,可提供数据库)
之前做了个购物车(原型效果[url=http://www.]www.[/url])
---------------------------------------------------------------------------------------------------------------------------
现在偶想为了更方便顾客使用,需要改进下,操作流程如下
1. 从商品信息页面product.s.asp中填写的 购物数量能提交到 shopcar.asp 购物车中
图片附件: 游客没有浏览图片的权限,请 登录注册

2.在购物车shopcar.asp中能修改各个商品的购物数量。
图片附件: 游客没有浏览图片的权限,请 登录注册

--------------------------------------------------------------------------------------------------------------------------
由于源代码含有数据库,超出附件上传容量。
有兴趣(需要代码)的朋友可以Q我 149366914 / 225733202 ,我长时间在线恭候你的到来。

[[italic] 本帖最后由 kira007 于 2007-11-29 12:04 编辑 [/italic]]
搜索更多相关主题的帖子: 源代码 购物车 数据库 SOS 难搞 
2007-11-29 09:43
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
收藏
得分:0 
附上主代码
products.asp [ 商品明细页面  ]
-----------------------------------------------------------------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include FILE="conn.asp"-->
<!--#include file="Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="Bookmark" href="favicon.ico">
<link rel= "icon "   href= "favicon.ico "   type= "image/x-icon "   media= "screen "   /> <link rel= "shortcut icon "   href= "favicon.ico "   type= "image/x-icon "   media="screen "/>
<title>广文商务办公文具批发配送中心</title>
<script language="javascript">
function Buy(ID)
{var selectProperty1=ID+"|"+document.form1.selectProperty1.value;
var selectProperty2=ID+"|"+document.form1.selectProperty2.value;
var selectProperty3=ID+"|"+document.form1.selectProperty3.value;
var selectProperty4=ID+"|"+document.form1.selectProperty4.value;
var selectProperty5=ID+"|"+document.form1.selectProperty5.value;
var selectProperty6=ID+"|"+document.form1.selectProperty6.value;
    window.open("shopcar.asp?ProdId="+ID+"&selectProperty1="+selectProperty1+"&selectProperty2="+selectProperty2+"&selectProperty3="+selectProperty3+"&selectProperty4="+selectProperty4+"&selectProperty5="+selectProperty5+"&selectProperty6="+selectProperty6,"","width=1000,height=768,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes,top=0,left=0");
}
</script>
</head>
<% id=request("id")
set rspp=Server.CreateObject("ADODB.RecordSet")
rspp.open"select * from product where id="&id,conn,1,1
'浏览统计
set rs = server.CreateObject("adodb.recordset")
rs.open "select * from product where ID="&id&"",conn,1,3
rs("viewnum")=rs("viewnum")+1
rs.update
rs.close
set rs=nothing
'浏览统计结束/获取图片地址
dim photo,PUrl
photo=rspp("spic")
if left(photo,3)="../"then
photo=right(photo,clng(len(photo))-3)
end if
PUrl="http://www.
'获取结束/向下向上翻页功能模块
function thenext
newrs=server.CreateObject("adodb.recordset")
sql="select top 1 * from product where id>"&id&" and smallclassid="&rspp("smallclassid")&" order by id"
set newrs=conn.execute(sql)
if newrs.eof then
response.Write"<img src='images/DD5.jpg' alt='下一件商品' width='15' height='13' border='0'>"
else
a2=newrs("id")
response.Write ("<a href='products.asp?id="&a2&"&smallclassid="&rspp("smallclassid")&"'>")
response.Write  "<img src='images/DD5.jpg' alt='下一件商品:"&newrs("name")&"' width='15' height='13' border='0'>"
response.Write ("</a>")
end if
end function
'下一篇文章功能结束
function thehead
headrs=server.CreateObject("adodb.recordset")
sql="select top 1 * from product where id<"&id&" and smallclassid="&rspp("smallclassid")&" order by id desc"
set headrs=conn.execute(sql)
if headrs.eof then
response.Write"<img src='images/DD6.jpg' alt='上一件商品' width='15' height='13' border='0'>"
else
a0=headrs("id")
AA= headrs("name")
response.Write ("<a href='products.asp?id="&a0&"&smallclassid="&rspp("smallclassid")&"'>")
response.Write "<img src='images/DD6.jpg' alt='上一件商品:"&aa&" ' width='15' height='13' border='0'>"
response.write ("</a>")
end if
end function %>
<body>
<table width="902" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td></td>
  </tr>
  <tr>
    <td height="3"><img name="" src="" width="1" height="5" alt=""></td>
  </tr>
</table>
<table width="902" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="28" background="images/BG.jpg"><img src="images/ICON2.jpg"  width="35" height="28" align="absmiddle">广文办公 → 商品展示</td>
  </tr>
  <tr>
    <td><img name="" src="" width="1" height="5" alt=""></td>
  </tr>
</table>
<table width="902" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E6E6E6">
  <tr bgcolor="#FFFFFF">
    <td width="415" align="center"><br>
      <table width="390"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="3"><img src="images/DD1.jpg" width="390" height="27"></td>
        </tr>
      <tr>
        <td><img src="images/DD2.jpg" width="15" height="360"></td>
        <td width="360" height="360" align="center" valign="middle" bgcolor="#000000"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.,0,29,0" width="360" height="360">
          <param name="movie" value="flash/VIEW_PIC.swf">
          <PARAM NAME="FlashVars" value="purl=<%=purl%>" />
          <param name="quality" value="high">
          <embed src="flash/VIEW_PIC.swf" FlashVars="purl=<%=purl%>" quality="high" pluginspage="http://www. type="application/x-shockwave-flash" width="360" height="360"></embed>
        </object></td>
        <td><img src="images/DD3.jpg" width="15" height="360"></td>
      </tr>
      <tr >
        <td height="49" colspan="3" background="images/DD4.jpg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="250"></td>
            <td width="15"><% thenext %></td>
            <td height="13" bgcolor="#656565"><img name="" src="" width="1" height="13" alt=""></td>
            <td width="15"><% thehead %></td>
            <td width="20"></td>
          </tr>
        </table></td>
        </tr>
    </table>
    <br></td>
    <td valign="top"><table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="30"><img src="images/arrow_r_02.gif" width="14" height="11"> <b><%=rspp("name")%> </b><%if rspp("tj")=1 then  response.write "<img src='images/new.jpg' align='absmiddle'>"  end if
                        if rspp("recommend")=2 then  response.write "<img src='images/tj.gif' align='absmiddle'>" end if%></td>
      </tr>
      <tr>
        <td height="3" bgcolor="#CB1216"><img name="" src="" width="1" height="3" alt=""></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><form action="#" method="post" name="form1"><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D2D2D2" class="en12-black">
         
            <tr>
              <td width="80" height="25" align="center" bgcolor="#EEEEEE">品 牌</td>
              <td bgcolor="#F9F9F9">&nbsp;<% set rsn = server.CreateObject("adodb.recordset")
rsn.open "select markname from b2b_parductppp where markID="&rspp("mark")&"",conn,1,1
if rsn.bof and rsn.eof then
response.write"无名品牌"
else
response.write rsn("markname")
end if
%>
            </td>
              <td width="80" align="center" bgcolor="#EEEEEE">型 号</td>
              <td bgcolor="#F9F9F9">&nbsp;<%=rspp("code")%></td>
            </tr>
            <tr>
              <td height="25" align="center" bgcolor="#EEEEEE">材 质</td>
              <td bgcolor="#F9F9F9">&nbsp;<%=trim(rspp("grade"))%></td>
              <td align="center" bgcolor="#EEEEEE">包 装</td>
              <td bgcolor="#F9F9F9">&nbsp;<%=trim(rspp("pweight"))%></td>
            </tr>
            <tr>
              <td height="25" align="center" bgcolor="#EEEEEE">积 分</td>
              <td bgcolor="#F9F9F9">&nbsp;<% if rspp("score")<1 then   response.write "0"  end if %><%=rspp("score")%></td>
              <td align="center" bgcolor="#EEEEEE">浏 览</td>
              <td bgcolor="#F9F9F9">&nbsp;<%=trim(rspp("viewnum"))%></td>
            </tr>
            <tr>
              <td height="25" align="center" bgcolor="#EEEEEE">零售价</td>
              <td bgcolor="#F9F9F9"><strong>&nbsp;¥
                    <% if rspp("price1")<1 then
                        response.write "0"
                        end if %>
                    <%=FormatNumber(rspp("price1"))%> 元</strong></td>
              <td align="center" bgcolor="#EEEEEE">白金会员</td>
              <td bgcolor="#F9F9F9">&nbsp;
                <%if LngGrpID=4 then
                          if rspp("price2")<1 then
                        response.write "¥ 0"
                        end if
                              response.write "<b><font color=#ff0000> "&FormatNumber(rspp("price2"))&" 元 </font></b>"
                            
                        else
                        %>
        ******
        <%end if%>
              </td>
            </tr>
            <tr>
              <%if LngGrpID=30 then %>
              <td height="25" align="center" bgcolor="#EEEEEE">金钻会员</td>
              <td bgcolor="#F9F9F9">&nbsp;<b><font color=#ff0000>
                <%
                          if rspp("price3")<1 then
                        response.write "¥ 0"
                        end if
                              response.write ""&FormatNumber(rspp("price3"))&"元"
                            
                        
                        %>
              </font></b></td>
              <%end if%>
              <td align="center" bgcolor="#EEEEEE">节 约</td>
              <td bgcolor="#F9F9F9"><strong><font color=#ff0000>&nbsp;¥
                      <% Select Case LngGrpID
Case ""
yPrice =0

Case 4
yPrice =FormatNumber(rspp("price1")-rspp("price2"))

Case 30
yPrice =FormatNumber(rspp("price1")-rspp("price3"))

Case 31
yPrice =FormatNumber(rspp("price1")-rspp("price4"))

Case 32
yPrice =FormatNumber(rspp("price1")-rspp("price5"))

End Select
if yprice<1 then
response.write  "0"
end if
response.write  yPrice %>
        元</font></strong><img src="images/sheng.jpg" width="24" height="24" align="absmiddle"></td>
            </tr>
            <tr>
              <td height="25" align="center" bgcolor="#EEEEEE">属 性</td>
              <td colspan="3" bgcolor="#F9F9F9"><table width="100%" border="0" cellspacing="4" cellpadding="4">
                  <%
                        Sql="select * from OtherProperty where PropertyName <> '' and PropertyValue <> '' "
                        set pRs = conn.execute(sql)
                        i=0
                        while not pRs.eof
                            i = i+1
                        %>
                  <tr>
                    <td><% response.write pRs("propertyname")%>
              
                <select name="selectProperty<% response.write pRs("id")%>">
                  <option>--请选择--</option>
                  <%
                                if rspp("OtherProperty"&i) <> "" then
                                    pValues=split(rspp("OtherProperty"&i),",")
                                    for j=0 to UBound(pValues)
                            %>
                  <option value="<%response.write pValues(j)%>" selected>
                  <%response.write pValues(j)%>
                  </option>
                  <%
                                    response.write pValues(j)
                                    next
                                end if
                            %>
                </select>
                    </td>
                  </tr>
                  <%
                            pRs.movenext
                        wend
                        
                        for h=i+1 to 5
                        %>
                  <input name="selectProperty<%=h%>" type="hidden" value="">
                  <%
                        next
                        %>
              </table></td>
            </tr>
            <tr>
              <td height="25" align="center" bgcolor="#EEEEEE">购物数量</td>
              <td colspan="3" bgcolor="#F9F9F9">&nbsp; <input name="selectProperty6" type="text" id="selectProperty6" value="1" size="4"></td>
            </tr>
        </table></form></td>
      </tr>
      <tr>
        <td height="40" align="center"><a href="Favorites.asp?ProductID=<%=rspp("ID")%>"><img src="sc.jpg" width="105" height="30" border="0" align="absmiddle"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="####" onClick="<%
  
      response.write "Buy('"&rspp("ID")&"');"
    
 %>"><img src="order.jpg" width="105" height="30" align="absmiddle" border="0"></a></td>
      </tr>
      <tr>
        <td height="25"><img src="images/arrow_r_02.gif" width="14" height="11"> <b>相关商品</b></td>
      </tr>
      <tr>
        <td height="3" bgcolor="#CCCCCC"><img name="" src="" width="1" height="3" alt=""></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E0E0E0">
          <tr>
            <td bgcolor="#FFFFFF"><table width="100%"  border="0" cellspacing="3" cellpadding="0">
              <tr><% set rsb=server.CreateObject("adodb.recordset")
             rsb.open"select top 6 name,id from product where id<>"&id&" and smallclassid="&rspp("smallclassid")&" order by id",conn,1,1
             if rsb.bof and rsb.eof then
             response.write"<td><font color='#ff0000'> 没有相关商品</font></td>"
             else
             n=0
             do while not rsb.eof and n<6 %>
                <td><%=n+1%> <a href="products.asp?id=<%=rsb("id")%>"><font color="#ff0000"><%dim strname
              strname=rsb("name")
              rsp=split(strname,"(")   
              response.write rsp(0) %></font></a></td><%n=n+1
              if n mod 3=0 then
              response.write"</tr><tr>"
              end if
              rsb.movenext
              loop
              end if
              rsb.close
              set rsb=nothing%>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<br>
<table width="902"  border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#FFA6A6">
  <tr>
    <td bgcolor="#FFFFFF"><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="images/SPMS.JPG" width="144" height="33"></td>
      </tr>
      <tr>
        <td height="1" bgcolor="#DFDFDF"><img name="" src="" width="1" height="1" alt=""></td>
      </tr>
      <tr>
        <td height="30"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="3" class="en12-black">
          <tr>
            <td><%=rspp("detail")%></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><img src="images/SPPL.JPG" width="144" height="33"></td>
      </tr>
      <tr>
        <td height="1" bgcolor="#DFDFDF"><img name="" src="" width="1" height="1" alt=""></td>
      </tr>
      <tr>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="1" bgcolor="#EEEEEE"></td>
          </tr>
          <tr>
            <td><table width="780" border="0" align="center" cellpadding="0" cellspacing="0" class="Cn12-big">
                <tr align="center">
                  <td width="50" height="25">NO</td>
                  <td width="1" valign="bottom"><img src="images/v_line2.jpg" width="1" height="15" align="absbottom"></td>
                  <td>客户评论</td>
                  <td width="1" valign="bottom"><img src="images/v_line2.jpg" width="1" height="15" align="absbottom"></td>
                  <td width="150">评论日期</td>
                </tr>
                <tr align="center" bgcolor="#ECECEC">
                  <td height="1" colspan="5"><img name="" src="" width="1" height="1" alt=""></td>
                </tr>
              </table>
                <table width="780" border="0" align="center" cellpadding="0" cellspacing="0" class="en12-black">
                  <% set rspl = server.CreateObject("adodb.recordset")
rspl.open "select * from review where id="&id&" and audit=1 ",conn,1,1
if rspl.eof and rspl.bof then
        response.write"<tr><td colspan=2 align='center' bgcolor='#D2FFFF'>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#ff0000>欢迎您对商品进行评论,表明您对此商品的感觉。</font></td></tr>"
        else
        y=1
        do while not rspl.eof %>
                  <tr align="center">
                    <td width="50" height="25"><%=y%> 楼</td>
                    <td width="7" valign="bottom">&nbsp;</td>
                    <td><table width="100%"  border="0" cellspacing="3" cellpadding="0">
                        <tr>
                          <td align="left" bgcolor="#D2FFFF"><img src="image/mespic.gif" width="21" height="19" align="absmiddle">正文:<%=rspl("reviewcontent")%></td>
                        </tr>
                        <tr>
                          <td align="left"><img src="image/mes.gif" width="18" height="15" align="absmiddle">回复:<%=rspl("replyto") %></td>
                        </tr>
                      </table>
                        <br>
                    </td>
                    <td width="7" valign="bottom"><br></td>
                    <td width="150" valign="top"><%=rspl("reviewdtm")%></td>
                  </tr>
                  <tr align="center" bgcolor="#EEEEEE">
                    <td height="1" colspan="5"><img name="" src="" width="1" height="1" alt=""></td>
                  </tr>
                  <% y=y+1
              rspl.movenext
        loop
        rspl.close
        set rspl=nothing
        end if%>
              </table></td>
          </tr>
          <tr>
            <td height="50" align="center"><input name="Submit3" type="submit" class="input_bot" onClick="MM_openBrWindow('pinglun.asp?id=<%=id%>','','width=300,height=300')" value="我要发表评论"></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<br>
<table width="902" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
        <br></td>
  </tr>
</table>
</body>
</html>

-----------------------------------------------------------------------------------------------------------------------------
shopcar.asp  购物车代码
****************************************************************************************************
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="Inc/Ubbcode.asp"-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>广文商务办公文具批发配送中心</title>
<link rel="Bookmark" href="favicon.ico">
<link rel= "icon "   href= "favicon.ico "   type= "image/x-icon "   media= "screen "   /> <link rel= "shortcut icon "   href= "favicon.ico "   type= "image/x-icon "   media="screen "/>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style>

<script language="Javascript">
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0

function dyniframesize(iframename) {
  var pTar = null;
  if (document.getElementById){
    pTar = document.getElementById(iframename);
  }
  else{
    eval('pTar = ' + iframename + ';');
  }
  if (pTar && !window.opera){
    //begin resizing iframe
    pTar.style.display="block"
   
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
      //ns6 syntax
      pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight;
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight){
      //ie5+ syntax
      pTar.height = pTar.Document.body.scrollHeight;
    }
  }
}
</script>
</head>
<body>
<%
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("Prodid"), ",")
For I=0 To UBound(Products)
   PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
'************************************************************************************
Sub PutToShopBagProperty1( selectProperty1, selectProperty1List )
   tmpStr = Split( selectProperty1,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty1List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty1List) = 0 Then
      selectProperty1List =selectProperty1
   Else
                   'Response.write "selectProperty1List:"&selectProperty1List&"<br>"
                   tmpList = Split( selectProperty1List,",")
                'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
                For i=0 To UBound(tmpList)
                    tmp = Split(tmpList(i),"|")
                    'response.write tmp(0)&"<br>"
                    if Trim(tmp(0)) <> "" then
                        if Trim(tmp(0)) = Trim(tmpStrID) then
                            '表示找到了,则改变为最新的选择情况
                            Flag = "True"
                            'Response.write tmp(0)&"|"&tmp(1) &"<br>"
                            'Response.write selectProperty1 & "<br>"
                            selectProperty1List = replace(selectProperty1List,tmp(0)&"|"&tmp(1),selectProperty1)
                            'Response.Write selectProperty1List & "<br>"
                            Exit For
                        end if
                    end if
                Next
                '没有的话,则直接加一个到Session里面
                if Flag <> "True" then selectProperty1List = selectProperty1List&", "&selectProperty1 &""
   End If
End Sub

selectProperty1List = Session("selectProperty1List")
Products = Split(Request("selectProperty1"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty1 Products(I), selectProperty1List
Next
Session("selectProperty1List") = selectProperty1List



Sub PutToShopBagProperty2( selectProperty2, selectProperty2List )
   tmpStr = Split( selectProperty2,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty2List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty2List) = 0 Then
      selectProperty2List =selectProperty2
   Else
                   'Response.write "selectProperty2List:"&selectProperty2List&"<br>"
                   tmpList = Split( selectProperty2List,",")
                'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
                For i=0 To UBound(tmpList)
                    tmp = Split(tmpList(i),"|")
                    'response.write tmp(0)&"<br>"
                    if Trim(tmp(0)) <> "" then
                        if Trim(tmp(0)) = Trim(tmpStrID) then
                            '表示找到了,则改变为最新的选择情况
                            Flag = "True"
                            'Response.write tmp(0)&"|"&tmp(2) &"<br>"
                            'Response.write selectProperty2 & "<br>"
                            selectProperty2List = replace(selectProperty2List,tmp(0)&"|"&tmp(1),selectProperty2)
                            'Response.Write selectProperty2List & "<br>"
                            Exit For
                        end if
                    end if
                Next
                '没有的话,则直接加一个到Session里面
                if Flag <> "True" then selectProperty2List = selectProperty2List&", "&selectProperty2 &""
   End If
End Sub

selectProperty2List = Session("selectProperty2List")
Products = Split(Request("selectProperty2"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty2 Products(I), selectProperty2List
Next
Session("selectProperty2List") = selectProperty2List

Sub PutToShopBagProperty3( selectProperty3, selectProperty3List )
   tmpStr = Split( selectProperty3,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty3List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty3List) = 0 Then
      selectProperty3List =selectProperty3
   Else
                   'Response.write "selectProperty3List:"&selectProperty3List&"<br>"
                   tmpList = Split( selectProperty3List,",")
                'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
                For i=0 To UBound(tmpList)
                    tmp = Split(tmpList(i),"|")
                    'response.write tmp(0)&"<br>"
                    if Trim(tmp(0)) <> "" then
                        if Trim(tmp(0)) = Trim(tmpStrID) then
                            '表示找到了,则改变为最新的选择情况
                            Flag = "True"
                            'Response.write tmp(0)&"|"&tmp(3) &"<br>"
                            'Response.write selectProperty3 & "<br>"
                            selectProperty3List = replace(selectProperty3List,tmp(0)&"|"&tmp(1),selectProperty3)
                            'Response.Write selectProperty3List & "<br>"
                            Exit For
                        end if
                    end if
                Next
                '没有的话,则直接加一个到Session里面
                if Flag <> "True" then selectProperty3List = selectProperty3List&", "&selectProperty3 &""
   End If
End Sub

selectProperty3List = Session("selectProperty3List")
Products = Split(Request("selectProperty3"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty3 Products(I), selectProperty3List
Next
Session("selectProperty3List") = selectProperty3List

Sub PutToShopBagProperty4( selectProperty4, selectProperty4List )
   tmpStr = Split( selectProperty4,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty4List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty4List) = 0 Then
      selectProperty4List =selectProperty4
   Else
                   'Response.write "selectProperty4List:"&selectProperty4List&"<br>"
                   tmpList = Split( selectProperty4List,",")
                'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
                For i=0 To UBound(tmpList)
                    tmp = Split(tmpList(i),"|")
                    'response.write tmp(0)&"<br>"
                    if Trim(tmp(0)) <> "" then
                        if Trim(tmp(0)) = Trim(tmpStrID) then
                            '表示找到了,则改变为最新的选择情况
                            Flag = "True"
                            'Response.write tmp(0)&"|"&tmp(4) &"<br>"
                            'Response.write selectProperty4 & "<br>"
                            selectProperty4List = replace(selectProperty4List,tmp(0)&"|"&tmp(1),selectProperty4)
                            'Response.Write selectProperty4List & "<br>"
                            Exit For
                        end if
                    end if
                Next
                '没有的话,则直接加一个到Session里面
                if Flag <> "True" then selectProperty4List = selectProperty4List&", "&selectProperty4 &""
   End If
End Sub

selectProperty4List = Session("selectProperty4List")
Products = Split(Request("selectProperty4"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty4 Products(I), selectProperty4List
Next
Session("selectProperty4List") = selectProperty4List

Sub PutToShopBagProperty5( selectProperty5, selectProperty5List )
   tmpStr = Split( selectProperty5,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty5List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty5List) = 0 Then
      selectProperty5List =selectProperty5
   Else
                   'Response.write "selectProperty5List:"&selectProperty5List&"<br>"
                   tmpList = Split( selectProperty5List,",")
                'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
                For i=0 To UBound(tmpList)
                    tmp = Split(tmpList(i),"|")
                    'response.write tmp(0)&"<br>"
                    if Trim(tmp(0)) <> "" then
                        if Trim(tmp(0)) = Trim(tmpStrID) then
                            '表示找到了,则改变为最新的选择情况
                            Flag = "True"
                            'Response.write tmp(0)&"|"&tmp(5) &"<br>"
                            'Response.write selectProperty5 & "<br>"
                            selectProperty5List = replace(selectProperty5List,tmp(0)&"|"&tmp(1),selectProperty5)
                            'Response.Write selectProperty5List & "<br>"
                            Exit For
                        end if
                    end if
                Next
                '没有的话,则直接加一个到Session里面
                if Flag <> "True" then selectProperty5List = selectProperty5List&", "&selectProperty5 &""
   End If
End Sub

selectProperty5List = Session("selectProperty5List")
Products = Split(Request("selectProperty5"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty5 Products(I), selectProperty5List
Next
Session("selectProperty5List") = selectProperty5List

'****************品牌属性开始搜索**********************************

Sub PutToShopBagProperty6( selectProperty6, selectProperty6List )
   tmpStr = Split( selectProperty6,"|")
   tmpStrID = tmpStr(0)
   tmpStrName = tmpStr(1)
   'Response.write "Session:"&Session("selectProperty1List")&"<br>"
   'Response.write "tmpStrID:"&tmpStrID&"<br>"
   'Response.write "tmpStrName:"&tmpStrName&"<br>"
   If Len(selectProperty6List) = 0 Then
      selectProperty6List =selectProperty6
   Else
                   'Response.write "selectProperty1List:"&selectProperty1List&"<br>"
                   tmpList = Split( selectProperty6List,",")
                'Response.write "UBound(tmpList):"&UBound(tmpList)&"<br>"
                For i=0 To UBound(tmpList)
                    tmp = Split(tmpList(i),"|")
                    'response.write tmp(0)&"<br>"
                    if Trim(tmp(0)) <> "" then
                        if Trim(tmp(0)) = Trim(tmpStrID) then
                            '表示找到了,则改变为最新的选择情况
                            Flag = "True"
                            'Response.write tmp(0)&"|"&tmp(1) &"<br>"
                            'Response.write selectProperty1 & "<br>"
                            selectProperty6List = replace(selectProperty6List,tmp(0)&"|"&tmp(1),selectProperty6)
                            'Response.Write selectProperty1List & "<br>"
                            Exit For
                        end if
                    end if
                Next
                '没有的话,则直接加一个到Session里面
                if Flag <> "True" then selectProperty6List = selectProperty6List&", "&selectProperty6 &""
   End If
End Sub

selectProperty6List = Session("selectProperty6List")
Products = Split(Request("selectProperty6"), ",")
For I=0 To UBound(Products)
   PutToShopBagProperty6 Products(I), selectProperty6List
Next
Session("selectProperty6List") = selectProperty6List
'************************** 搜索结束 ************************************************

if request("payment")="去收银台" then
response.redirect "b2b_ddlcsys.asp?action=1"
end if

If Request("cmdShow") = "Yes" Then
   ProductList = ""
   Products = Split(Request("ProdId"), ", ")
   For I=0 To UBound(Products)
      PutToShopBag Products(I), ProductList
   Next
   Session("ProductList") = ProductList
End If
If Len(Session("ProductList")) = 0 Then
Response.write "<br><table width='350' border='0' align='center' cellpadding='0' cellspacing='3' bgcolor='#F0F0F0'><tr><td valign='top' bgcolor='#FFFFFF'><table width='98%'  border='0' align='center' cellpadding='0' cellspacing='3'><tr><td height='30' ><img src='images/EORR.jpg' ></td></tr><tr><td height='30' align='center' ><b>广州办公易文化用品批发配送网提示您!</b></td></tr><tr><td height='1' bgcolor='#E30000'></td></tr><tr><td height='30' align='center' ><b>你的购物车当前为空!</b></td></tr><tr><td height='30' align='center' ><a href=product.asp><font size=2>去商城逛逛</font></a>      <a href=""JavaScript:onClick=window.close();""><font size=2>关闭窗口</font></a></td></tr></table></td></tr></table>"
Response.end
end if
%>
<table width="902" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td></td>
  </tr>
  <tr>
    <td height="3"><img name="" src="" width="1" height="5" alt=""></td>
  </tr>
</table>
<table width="902" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="28" background="images/BG.jpg"><img src="images/ICON2.jpg" width="35" height="28" align="absmiddle">广文办公 → 我的购物车</td>
  </tr>
  <tr>
    <td><img name="" src="" width="1" height="5" alt=""></td>
  </tr>
</table>
<table width="902" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="99%"  border="0" align="right" cellpadding="0" cellspacing="1" bgcolor="#E6E6E6">
      <tr>
        <td bgcolor="#FFFFFF"><img src="images/shopcar.jpg"><table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" bgcolor="#f2f2f2" class="en12-black">
          <form action="shopcar.asp" method="POST" name="check" >
            <tr bgcolor="#f7f7f7" height="25" align="center">
              <td width="10%" bgcolor="#f7f7f7"><strong>编 号</strong></td>
              <td><strong>商 品 名 称</strong></td>
              <td><strong> 单 位</strong></td>
              <td><strong>数 量</strong></td>
              <td><strong>单 价</strong></td>
              <td><strong>积 分</strong></td>
              <td><strong>小 计</strong></td>
            </tr>
            <%
Set rsCheck=Server.CreateObject("ADODB.RecordSet")
strsql="select ID,Name,Score,pweight,type,Price1,Price2," & LstPrice & ",amount,VipPrice,Pic,Code from Product where ID in ("&Session("ProductList")&") order by ID"
rsCheck.open strsql,conn,1,1
Sum = 0
SumS = 0
Quatity = 1
NUMS=1
Do While Not rsCheck.EOF
     Quatity = CInt( Request.Form( "Q_" & rsCheck("ID")) )
     If Quatity <= 0 Then
        Quatity = CInt( Session(rsCheck("ID")) )
        If Quatity <= 0 Then Quatity = 1
     End If
Session(rsCheck("ID")) = Quatity



Dim YourPrice,strprice2,strvipprice,ProScore
strprice1 = Round(rsCheck("Price1"),2)
strprice2 = Round(rsCheck("Price2"),2)
strvipprice = Round(rsCheck("VipPrice"),2)
ProScore = rsCheck("Score")
YourPrice =  Round(rsCheck("" & LstPrice & ""),2)
Sum = Sum + (YourPrice + strvipprice)*Quatity
Sum=Round(Sum,2)
SumS = SumS + ProScore*Quatity

%>
            <tr bgcolor="#FFFFFF" height="25" align="center">
              <td><input type="CheckBox" name="ProdId" value="<%=rsCheck("ID")%>" Checked>
        [<%=NUMS%>]</td>
              <td align="left"><a href="products.asp?ID=<%=rsCheck("ID")%>" target="_blank"><%=rsCheck("Name")%></a><a href="product.asp?ID=<%=rsCheck("ID")%>" target="_blank"> </a>[<%
                           Flag=""
                  selectProperty1List= Split( Session("selectProperty1List"),",")
                For I=0 To UBound(selectProperty1List)
                    tmp = Split(selectProperty1List(I),"|")
                    if Trim(tmp(0)) <> "" then
                        if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
                            Flag = Flag & Trim(tmp(1))&","
                            Exit For
                        end if
                    end if
                Next
                
                
                  selectProperty2List= Split( Session("selectProperty2List"),",")
                For I=0 To UBound(selectProperty2List)
                    tmp = Split(selectProperty2List(I),"|")
                    if Trim(tmp(0)) <> "" then
                        if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
                            Flag = Flag & Trim(tmp(1))&","
                            Exit For
                        end if
                    end if
                Next
                
                  selectProperty3List= Split( Session("selectProperty3List"),",")
                For I=0 To UBound(selectProperty3List)
                    tmp = Split(selectProperty3List(I),"|")
                    if Trim(tmp(0)) <> "" then
                        if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
                            Flag = Flag & Trim(tmp(1))&","
                            Exit For
                        end if
                    end if
                Next
                
                  selectProperty4List= Split( Session("selectProperty4List"),",")
                For I=0 To UBound(selectProperty4List)
                    tmp = Split(selectProperty4List(I),"|")
                    if Trim(tmp(0)) <> "" then
                        if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
                            Flag = Flag & Trim(tmp(1))&","
                            Exit For
                        end if
                    end if
                Next    
                
                  selectProperty5List= Split( Session("selectProperty5List"),",")
                For I=0 To UBound(selectProperty5List)
                    tmp = Split(selectProperty5List(I),"|")
                    if Trim(tmp(0)) <> "" then
                        if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
                            Flag = Flag & Trim(tmp(1))&","
                            Exit For
                        end if
                    end if
                Next    
                Response.Write(Flag)%> 数量:<%
        selectProperty6List= Split( Session("selectProperty6List"),",")
                For I=0 To UBound(selectProperty6List)
                    tmp = Split(selectProperty6List(I),"|")
                    if Trim(tmp(0)) <> "" then
                        if (Trim(tmp(0)) = Trim(rsCheck("ID"))) and (Trim(tmp(1))<>"") then
                            buynums = Trim(tmp(1))
                            Exit For
                        end if
                    end if
                Next    
                Response.Write(buynums)%>] </td>
              <td><%=rsCheck("TYPE") %></td>
              <td><input type="Text" name="<%="Q_" & rsCheck("ID")%>" value="<%=Quatity%>" size="4" class="input_sr" onMouseOver="this.focus()" onMouseOut="if(this.value=='')this.value='';" onFocus="this.select()" onClick="if(this.value=='')this.value=''" ></td>
              <td><% if YourPrice <1 then response.write"0" end if%>
                  <%=YourPrice %></td>
              <td><%=ProScore*Quatity %></td>
              <td><%if Round((YourPrice + strvipprice)*Quatity,2)<1 then response.write"0" end if%>
                  <%=Round((YourPrice + strvipprice)*Quatity,2) %></td>
            </tr>
            <%NUMS=NUMS+1
     rsCheck.MoveNext
     Loop
rsCheck.close
set rsCheck=nothing
%>
            <tr bgcolor="#F7F7F7">
              <td height="25" colspan="8" align="center" valign="middle"><input name="order" type="submit" class="input_bot" value="更改商品">
&nbsp;&nbsp;&nbsp;
        <input name="payment" type="submit" class="input_bot" value="去收银台">
&nbsp;&nbsp;&nbsp;
        <input name="button" type="button" class="input_bot" onClick="javascript:window.close()" value="继续购物" language=javascript>
        <input type="hidden" name="cmdShow" value="Yes">
&nbsp;&nbsp;&nbsp;&nbsp;您现在是:<%= strTitle %> | 价格总计:<font color="#FF0000"><b><%=Round(Sum,2) %></b></font>&nbsp;元 | 获得积分:<%=SumS %>&nbsp;分 </td>
            </tr>
          </form >
        </table><br>

          </td>
      </tr>
    </table></td>
  </tr>
</table>
<br>

<table width="902" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<br></td>
  </tr>
</table>

</body>
</html>

生活的理想,就是为了理想的生活。
2007-11-29 11:38
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
收藏
得分:0 
用 砍脚趾 避砂虫 的方法,总算实现了我要的效果了。
虽然还不算完美。

生活的理想,就是为了理想的生活。
2007-11-29 15:55
cplove
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-1-10
收藏
得分:0 
fdsfds
2008-01-10 21:25
lele2007
Rank: 5Rank: 5
来 自:广东省深圳
等 级:职业侠客
威 望:6
帖 子:1028
专家分:305
注 册:2007-9-4
收藏
得分:0 
头晕了

学习编程www.
2008-01-10 23:26
zuojs
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2006-3-21
收藏
得分:0 
说实在的,这么多代码, 可能要一行一行的啃了...我想迅速提高我的技能..但什么时候呢?怎么去做??

在淘宝我有个瑜珈专卖垫,如有兴趣的朋友,可以跑一跑、看一看哦。。。。http://shop34515968./
2008-01-10 23:49
dhdhzzw
Rank: 1
等 级:新手上路
帖 子:949
专家分:0
注 册:2007-8-13
收藏
得分:0 
兄弟,我看你用的是动易或其他程序的管理系统,我想问问你是怎么把自己的网店系统集成上去的。。。因为我看这是你自己的代码,但那些程序一般都是封进组件的。。。。。。。。。。。。。
2008-01-11 09:00
快速回复:[ 求助 SOS ] 一个难搞的购物车问题,(附上源代码,可提供数据库)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028000 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved