得它的 sortPath, 保存到商品记录就行了。 修改类似。 [8]后台商品删除 和分类不相关,直接根据 productID 删除就可。 五、附加信息 目前还没有拆分出来的代码给大家(太麻烦),主要的东西都在上面啦。 师傅领进门,修行在个人啦。
复制内容到剪贴板
代码: 代码:
'-----根据 ID 取得 name 的 Sub----------------Function getValueByID(sortID,inArray) dim i if NOT IsArray(inArray) then getValueByID="" Exit Function end if for i=0 to UBound(inArray,2) if Cstr(sortID)=Cstr(inArray(0,i)) then getValueByID=inArray(1,i) '返回 name Exit Function end if next getValueByID="" End Function
<%@ CODEPAGE="936"%> <% myAction=trim(request("myAction")) parentID=trim(request("parentID")) '选择的类别 toParentID=trim(request("toParentID")) '移动到的类别 new_sortName=trim(request("new_sortName")) '新增的
类别名称 edit_sortName=trim(request("edit_sortName")) '修改的类别名称 if parentID="" or NOT IsNumeric(parentID) then call showMsg("请选择要操作的类别。") end if '================执行操作================ select case myAction case "addSort" if new_sortName="" or Len(new_sortName)>50 then call showMsg("请输入新增类别的名称(少于 50 字)。")
end if '--
查询父节点的路径 set rs=server.CreateObject("adodb.recordset") sql="select * from TBL_Sort where sortID="&;parentID rs.open sql,conn,1,3 if parentID=0 then '根节点不存在,直接赋值。 sortPath="0," else if noRecord(rs) then call closeRs(rs) call showMsg("指定类别不存在。") end if sortPath=rs("sortPath") '父节点的路径 end if '--新增记录 rs.addNew rs("sortName")=new_sortName rs("parentID")=parentID rs("sortPath")=sortPath &; rs("sortID") &;"," '格式如:3,5,23,45, rs.update call closeRs(rs) call closeConn() backURL="admin_manageSort.asp" case "editSort" if parentID="0" then call showMsg("根目录不能改名,请选择其他类别。") end if edit_sortName=replace(edit_sortName,"'","''") if edit_sortName="" or L