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

📄 admin_update_product.asp

📁 添加商品进入中心数据库
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%@ Language=VBScript %>
<!--#INCLUDE FILE="includes/adovbs.asp"-->
<!--#INCLUDE FILE="includes/connstr.asp"-->
<% 
if trim(Session("LoggedUser"))<> "" then
dim acnDB, arsDB, prod_id, arsDBCat, arsDBSubCat, arsDBCat1,arsDBSubCat1,arsDBBrd, arsDBHmPrd
set acnDB = Server.CreateObject("ADODB.Connection")
set arsDB = Server.CreateObject("ADODB.Recordset")
set arsDBCat = Server.CreateObject("ADODB.Recordset")
set arsDBSubCat = Server.CreateObject("ADODB.Recordset")
set arsDBCat1 = Server.CreateObject("ADODB.Recordset")
set arsDBSubCat1 = Server.CreateObject("ADODB.Recordset")
set arsDBBrd = Server.CreateObject("ADODB.Recordset")
set arsDBHmPrd = Server.CreateObject("ADODB.Recordset")

acnDB.ConnectionString = connstr
acnDB.Open
if Request.Form("frmSubmit") = "U" then
	'dim details, hm_item, count, namename, descname
	'for count = 1 to 20
	'	namename = "txtdetailname" & count
	'	descname = "txtdetail" & count
	'	if Request.Form(namename) <> "" then
	'		if count = 1 then
	'		details = details & Request.Form(namename)
	'		else
	'		details = details & "||" & Request.Form(namename)
	'		end if
	'		details = details & "|" & Request.Form(descname)
	'	end if
	'next
	strSQL = "update product set category_id="& Request.Form("cbosubcate") & ", brand_id=" & Request.Form("cbobrd") & ",prd_name='" & Request.Form("txtName") & "',prd_desc='" & Request.Form("txtdesc") & "',prd_intro='" & Request.Form("txaprdintro") & "',prd_features='" & Request.Form("txaprdfeatures") & "',app_link='" & Request.Form("txtUrl") & "',prd_details='" & Request.Form("txtdetailname")&"||"&Request.Form("txtdetaildesc") & "',act_price=" & Request.Form("txtListPrice") & ",parcel_units=" & Request.Form("txtParcelUnits") & ",our_price=" & Request.Form("txtOurPrice") & ",home_item='" & Request.Form("homeitem") & "',upd_date=getdate(),enable='"&Request.Form("enableitem")&"'"
	strSQL = strSQL & " where prod_id = " & Request.Form("prod_id")
	acnDB.Execute strSQL
	if Request.Form("cboReplItem") <> "" then
		strSQL = "Update product set home_item = 'N' where prod_id = " & Request.Form("cboReplItem")
		acnDB.Execute strSQL
	end if
	Response.Redirect "register_message.asp?type=updprd"	
elseif Request.Form("frmSubmit") = "D" then
	strSQL = "Update product set active = 'N', upd_date = getdate() where prod_id = " & Request.Form("prod_id")
	acnDB.Execute strSQL
	Response.Redirect "register_message.asp"	
else 
	arsDBCat.Open "select category_id,cat_name from category where active='Y' and parent_id is null",acnDB	

	arsDBCat1.Open "SELECT parent_id,category.category_id, category.cat_name FROM product INNER JOIN category ON product.category_id = category.category_id where product.active='Y' and prod_id = " & trim(Request.QueryString("id")),acnDB
	arsDBSubCat1.Open "SELECT category.parent_id, category_1.category_id, category_1.cat_name FROM product INNER JOIN category ON product.category_id = category.category_id INNER JOIN  category category_1 ON category.parent_id = category_1.parent_id where product.active='Y' and prod_id = " & trim(Request.QueryString("id")),acnDB
arsDBSubCat.Open "SELECT category_id, parent_id, cat_name FROM category WHERE active='Y' and parent_id is not null",acnDB
	arsDBBrd.Open "select brand_id,brd_name from brand where active='Y'",acnDB
	arsDBHmPrd.Open "select prod_id, prd_name from product where home_item = 'Y' and active='Y'",acnDB,adOpenStatic
	arsdb.Open "select * from product where active='Y' and prod_id = " & trim(Request.QueryString("id")),acnDB
end if
else
	Response.Redirect "login.asp"
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Welcome to Waytec EShop</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="includes/waytec_eshop.css" rel="stylesheet" type="text/css">
<script language=Javascript>
arrSelect=new Array(); 
<%index =0 
	do until arsDBSubCat.EOF %>	
arrSelect[<%=index%>]=new Array("<%=arsDBSubCat.Fields("cat_name")%>",<%=arsDBSubCat.Fields("parent_id")%>,<%=arsDBSubCat.Fields("category_id")%>) 
<%index = index + 1
arsDBSubCat.MoveNext
loop
%>
function change_select(selvalue)   
{  
 document.all.cbosubcate.length=0;   

var newOption;
	newOption=new Option("Select Sub Category"); 
	 document.all.cbosubcate.options.add(newOption); 
 for(i=0;i<arrSelect.length;i++)  
 { 
 	

  if(arrSelect[i][1]==selvalue)  
  { 
  
   newOption=new Option(arrSelect[i][0],arrSelect[i][2]); 
   document.all.cbosubcate.options.add(newOption); 
  } 
  }

} 
function validateform(act) {
	if (act=="U") {
		if (ValidateNull(frmRegister.txtName,"Name")) {
			return;
		}
		if (ValidateNull(frmRegister.txtDesc,"Description")) {
			return;
		}
		if (ValidateNull(frmRegister.cbocat,"Category")) {
			return;
		}
		if (ValidateNull(frmRegister.cbosubcate,'Sub Category')) {
		return;
		}
		if (ValidateNull(frmRegister.cbobrd,"Brand")) {
			return;
		}
		if ((frmRegister.HomeYesNo(0).status) && (frmRegister.HomeYesNo(0).value >= 4)) {
			if (frmRegister.cboReplItem.value=="") {
				alert ("You have opted to put this item in the home page. But you have not specified which home item to replace with. Please select one.");
				return;
			}
		}
		if (ValidateNumber(frmRegister.txtListPrice,1,"List Price")) {
			return;
		}	
		if (ValidateNumber(frmRegister.txtOurPrice,1,"Our Price")) {
			return;
		}	
		if (ValidateNumber(frmRegister.txtParcelUnits,1,"Units per Parcel")) {
			return;
		}	
		frmRegister.enableitem.value = "N";
	if (frmRegister.enableYesNo(0).status) 
		frmRegister.enableitem.value = "Y";
		frmRegister.homeitem.value = "N";
		if (frmRegister.HomeYesNo(0).status) 
			frmRegister.homeitem.value = "Y";
	}
	document.frmRegister.frmSubmit.value = act;
	document.frmRegister.submit();
}

function ValidateNull(vControl,vName) {
	for(i=0;i<vControl.value.length;i++)
		{
			if(vControl.value.charAt(i)!=" ") {
				return false;
			}
		}
		alert("Enter a valid value for " + vName + ", Value should not be blank");
		vControl.focus();
		return true;
}

function ValidateNumber(vControl,LentoCheck,vName) {
	if(LentoCheck > 0 && vControl.value=="") {
				alert("Enter a valid value for " + vName + ", Value should not be null");
				vControl.focus();
				return true;
	}
		for(var i=0;i<vControl.value.length;i++) {
			if (vControl.value.charCodeAt(i) < 48 || vControl.value.charCodeAt(i) > 57) {
					alert("Enter a valid value for " + vName + ", Value should be numeric");
				vControl.focus();
				return true;
			}
		}
}

function NoHome() {
	if (frmRegister.HomeYesNo(0).status) 
		frmRegister.cboReplItem.disabled = false;
	else
		frmRegister.cboReplItem.disabled = true;
}
</script>
<script type='text/javascript' src='includes/general_functions.js'></script>
</head>

<body>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#999999"><table width="780" border="0" cellspacing="1" cellpadding="0">
      <tr>
        <td bgcolor="#FFFFFF">
<!--#INCLUDE FILE="includes/TopMenu.inc"-->

<!-- Replace this portion with the portion below. This is required to display the User Name, link to admin section (if administrator), update user profile links after login to the system

<table width="780" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="right"><img src="images/inner_shopping_cart_bottom.jpg" width="224" height="33"></td>
  </tr>
</table>

End of replacing section-->

<!-- Section starts for the details displayed after login-->
<!--#INCLUDE FILE="includes/submenu_home.inc"-->
<!--Section ends here-->
<table width="780" border="0" cellspacing="0" cellpadding="0">
  <tr> <td width="169" valign="top">
<!--#INCLUDE FILE="includes/left_nav_menu.inc"--></td>
    <td width="10">&nbsp;</td>
    <form name="frmRegister" action="admin_update_product.asp" method="POST">
    <td valign="top"><table width="566" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="565" align="right" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="50" align="left" valign="bottom" class="header">Update Product </td>
                <td width="20" align="right" valign="middle">&nbsp;</td>
              </tr>
              <tr>
                <td height="5" align="right" valign="bottom"></td>
                <td align="right" valign="middle"></td>
              </tr>
            </table>
            <table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="1" align="right"><img src="images/line_horizontal.gif" width="450" height="1" border="0"></td>
              </tr>
            </table>
            <table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td colspan="3" align="right" valign="bottom" class="9pointBLue">&nbsp;</td>
                <td width="21" height="10" valign="bottom">&nbsp;</td>
              </tr>
			  <input type=hidden name="prod_id" id="prod_id" value="<%=trim(Request.QueryString("id"))%>">	
              <tr>
                <td height="23" align="right" class="9Point">Product Name </td>
                <td width="12" align="center" class="9pointBold">:</td>
                <td><input name="txtName" type="text" class="textBox" style="width:100% " value="<%=arsDB.Fields("prd_name")%>"></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="23" align="right" class="9Point">Description</td>
                <td align="center"><span class="9pointBold">:</span></td>
                <td><input name="txtDesc" type="text" class="textBox" style="width:100%" value="<%=arsDB.Fields("prd_desc")%>"></td>
                <td>&nbsp;</td>
              </tr>
			  <tr>
                <td height="23" align="right" class="9Point">Listed Price </td>
                <td width="12" align="center"><span class="9pointBold">:</span></td>
                <td><input name="txtListPrice" type="text" class="textBox" style="width:100% " value="<%=arsDB.Fields("act_price")%>"></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="23" align="right" class="9Point">Our Price </td>
                <td align="center"><span class="9pointBold">:</span></td>
                <td><input name="txtOurPrice" type="text" class="textBox" style="width:100%" value="<%=arsDB.Fields("our_price")%>"></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="23" align="right" class="9Point">Units per Parcel </td>
                <td align="center"><span class="9pointBold">:</span></td>
                <td><input name="txtParcelUnits" type="text" class="textBox" style="width:100%" value="<%=arsDB.Fields("parcel_units")%>"></td>

⌨️ 快捷键说明

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