<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      購物車范例(購物車頁面 )

      [摘要]<!--checkbag.asp--><!--shoppingcart page--><% response.expires = 0 response.expiresabsolute = Now() - 1 response.addHeader ...
      <!--checkbag.asp-->

      <!--shoppingcart page-->

      <%  
          response.expires = 0
          response.expiresabsolute = Now() - 1
          response.addHeader "pragma","no-cache"
          response.addHeader "cache-control","private"
          Response.CacheControl = "no-cache"
      %>

      <!--#include file= "conn.asp"-->
      <!--#include file= "char.inc"-->

      <%
          'id_type=request("id_type")
          obj=request("obj")       '用做檢測是否是正常購買后的進入購物車取obj參數
          rid=session("id")         '取出會員id
          dim x,i
          dim obj_bag,bag_item,cart
                 'obj_bag          ----購物車
                 'bag_item        ----商品的信息數據集合
                 'cart                ----一件商品的信息數據集合
          dim p_id,p_name,p_price,p_manu,p_type,p_size,p_color,p_num,p_total,sum
                  'p_id               ----商品id號
                  'p_name         ----商品名稱
                  'p_price          ----價格
                  'p_manu         ----制造商
              'p_type           ----商品式樣
                  'p_size           ----尺寸
              'p_color          ----顏色
                  'p_num           ----數量
                  'p_total           ----小計
                  'sum              ----合計金額

          dim id1

          if obj="1" then                                     obj為1說明由菜單欄點擊進入的
              if not isobject(Session("Bag")) then            如果Session("Bag")不是對象,說明購物車為空
                  response.write "<script language=""javascript"">"
                  response.write"alert(""購物車為空!"");" & chr(13)
                  response.write "window.location='index.asp'"
                  response.write "</script>"
                  response.end
              else
                  set obj_bag=Session("Bag")           若購物車不為空,將它賦給對象obj_bag
              end if
          else
              if isobject(Session("Bag")) then                  若不是菜單欄點擊進入的,則將購物車信息賦給對象obj_bag

                  set obj_bag=Session("Bag")
              else                                                         若購物車為空,說明購物車內沒有商品,則返回首頁
                  response.write "<script language=""javascript"">"
                  response.write"alert(""T購物車為空!"");" & chr(13)
                  response.write "window.location='index.asp'"
                  response.write "</script>"
                  response.end
              end if
            end if
                  'response.write "<script>alert("""& isobject(obj_bag) &""")</script>"
            
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      '判斷單擊的是購物車頁面下方的哪一個按鈕
      ''''''''''''''''''''''''''''''''''''''''

          select case request("action")          取得按鈕信息
         如果選擇刷新則重新計算商品的價值及總價
         將當前信息計算寫入購物車并顯示購物車
              case "refresh"        若為刷新   
                  for each cart in obj_bag.items
                      p_name=cart(0)     將購物車中的信息數據集合分別賦值給變量
                      p_manu=cart(1)
                      p_type=cart(2)
                      p_size=cart(3)
                      p_color=cart(4)
                      p_price=cart(5)
                      p_num=cart(6)
                      p_id=cart(7)

                      if request("checkBox_" & p_id)<>"" then         取得取消單選框的值,如果不為空,即打鉤
                          if obj_bag.Exists(p_name) then         如果商品已存在刪除該商品
                              obj_bag.remove(p_name)
                          end if
                      else
                          p_num=trim(request("quantity"&p_name))     若沒有該操作,寫入購物車
                          if ((not IsNumeric(p_num)) or (p_num<="0") or (instr(1,p_num,".")<>0)) then
                              p_num=1
                          end if
                          bag_item=array(p_name,p_manu,p_type,p_size,p_color,p_price,p_num,p_id)
                          'response.write "p_num=" & p_num & "<br>"
                      end if
                  next
                  set Session("Bag")=obj_bag            將obj_bag對象里的信息,寫入Session("Bag")

      如果選擇去收銀臺則準備開始接收付款
      將當前信息寫入購物車并轉向收銀程序
              case "check"                                               按鈕為購買的時候
                  for each cart in obj_bag.items            循環cart將其所有信息都賦給變量
                      p_name=cart(0)
                      p_manu=cart(1)
                      p_type=cart(2)
                      p_size=cart(3)
                      p_color=cart(4)
                      p_price=cart(5)
                      p_num=cart(6)
                      p_id=cart(7)
                  
                      if request("checkBox_" & p_id)="" then  如果取消單選框為空,取id1的值
                          id1=p_id & "," & id1                 將他們有逗號形式連接
                      end if
                  next
                  id1=left(id1,len(id1)-1)                                  
                  shopping_id=request("id")
                  set obj_bag=session("bag")
                  set session("obj_bag")=obj_bag    
                  call insertDB(id1)                                             調用函數
          end select
      %>
      '輸出HTML
      。。。。。。。。。(略)




      日韩精品一区二区三区高清