⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xt_orderform_additem.asp

📁 用ASP写的电子购物系统
💻 ASP
字号:
<!--#INCLUDE FILE="include/shop.asp" -->
<!--#INCLUDE FILE="include/util.asp" -->

<% REM ##########################################################################%>
<% REM                                                                          #%>
<% REM   XT_ORDERFORM_ADDITEM.ASP                                               #%>
<% REM   增加商品到订单                                                         #%>
<% REM                                                                          #%>
<% REM   Copyright (c) 1999-2000 Epro Corporation.  All rights reserved.        #%>
<% REM                                                                          #%>
<% REM ##########################################################################%>

<%
dim errorList 


On Error Goto 0

REM -- retrieve quantity:
quantity = checknum(Request("quantity"),3)

if isNull(quantity) then
	 quantity=1
    'errorList.Add("商品数量必须是1 到 999之间的数字。")
end if

pfid=request("pfid")
if isNull(pfid) or isEmpty(pfid) then
   errorList=errorList & "必须有一个商品号。<br>"
end if 
%>

<%
if errorList<>"" then
%>
    <!--#INCLUDE FILE="include/error.asp" -->
<%
else
     
    cmdTemp.CommandText = "SELECT * FROM product WHERE product_id = '" & Replace(pfid, "'", "''") & "'"

    Set recordSet = Server.CreateObject("ADODB.Recordset")
    recordSet.Open cmdTemp, , adOpenKeyset, adLockOptimistic
    
    if recordSet.RecordCount = 0 then
       errorList=errorList & "没有该商品。<br>"
    else
       if not Isnull(recordSet("Product_type")) then
          if trim(cstr(recordSet("Product_type")))<>"" then
             if trim(cstr(request("Product_type_name")))="" then
                Response.Redirect "product_view.asp?pfid="+pfid
             end if
          end if
       end if
       product_no=recordSet("product_no").value
       name=recordSet("name").value
      'if recordset("adjusted_price").value<>"" then
	  '	    adjusted_price=recordset("adjusted_price").value
      'else
	  '		adjusted_price=recordset("List_price").value
      'end if
       list_price=recordset("list_price").value
       rmb_price=recordset("rmb_price").value
       market_id=recordset("market_id").value
    end if
    REM Redirect to the basket
    
    cmdTemp.CommandText = "SELECT * FROM basket WHERE session_id = '" & session.SessionID & "' and  product_id='" & Replace(pfid, "'", "''") & "'"

    Set rstCart = Server.CreateObject("ADODB.Recordset")
    rstCart.Open cmdTemp, , adOpenKeyset, adLockOptimistic
    if rstCart.RecordCount =0 then 

        rstCart.AddNew
	    rstCart("session_id").Value        = cstr(session.SessionID )
	    rstCart("product_id").Value        = pfid
	    rstCart("product_no").Value        = product_no
	    rstCart("name").Value              = name
	    rstCart("quantity").Value          = quantity
	    'rstCart("Adjusted_price").Value    = adjusted_price
	    rstCart("list_price").Value		   = list_price
	    rstCart("rmb_price").Value		   = rmb_price
	    rstCart("market_id").Value		   = market_id
	    if request("Product_type_name")<>"" then
	       rstCart("Product_type").value   = trim(cstr(request("Product_type_name"))) + ":" + trim(cstr(request("Product_type"))) + "*" + cstr(csng(quantity))
	    end if
	    
   else
       oldquantity=rstCart("Quantity").Value
       if not Isnull(rstCart("Product_type")) then
          if trim(cstr(rstCart("Product_type")))<>"" then
             oldproducttype=trim(cstr(rstCart("Product_type")))
             rstCart("Product_type").Value      = trim(cstr(oldproducttype)) + ";" + trim(cstr(request("Product_type"))) + "*" + cstr(Csng(quantity))
          end if   
       end if
       rstCart("Quantity").Value          = cstr(Csng(quantity)+Csng(oldquantity))
       
   end if 

   rstCart("date_changed").Value      = Now 

   rstCart.Update

end if %>
<%
if errorList<>"" then
%>
    <!--#INCLUDE FILE="include/error.asp" -->
<%
else
	Response.Redirect Request("goto")
end if 
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -