File: D:/web/homefly/vsadmin/inc/incmenu.asp
<%
'This code is copyright (c) Internet Business Solutions SL, all rights reserved.
'The contents of this file are protect under law as the intellectual property
'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying
'of any kind without the express and written permission of Internet Business
'Solutions SL is forbidden.
'Author: Vince Reid, vince@virtualred.net
Dim mSQL,mRS,mCnn,mAlldata
Set mRS = Server.CreateObject("ADODB.RecordSet")
Set mCnn=Server.CreateObject("ADODB.Connection")
on error resume next
err.number = 0
mCnn.open sDSN,mSubCats
sSQL = "SELECT adminSubCats FROM admin"
mRS.Open sSQL,mCnn,0,1
mSubCats=(Int(mRS("adminSubCats"))=1)
mRS.Close
if mSubCats then
mSQL = "SELECT DISTINCT sectionID,sectionName,tsID,tsName,tsOrder,sectionOrder FROM topsections INNER JOIN sections ON sections.topSection=topsections.tsID ORDER BY tsOrder,sectionOrder"
else
mSQL = "SELECT DISTINCT sectionID,sectionName,sectionOrder FROM sections INNER JOIN products ON sections.sectionID=products.pSection WHERE pDisplay <> 0 ORDER BY sectionOrder"
end if
mRS.Open mSQL,mCnn,0,1
if NOT mRS.EOF then mAlldata = mRS.getrows
mRS.Close
mCnn.Close
if err.number <> 0 then
response.write "mymenu.addSubMenu(""products"", """", ""<b>Please set your database connection</b>"", ""http://www.ecommercetemplates.com/help/ecommplus/faq.asp"");"&vbCrLf
elseif IsArray(mAlldata) then
mLasttsid = -1
if mSubCats then
FOR mIndex=0 TO ubound(mAlldata,2)
if mLasttsid <> mAlldata(2,mIndex) then
mLasttsid = mAlldata(2,mIndex)
response.write "mymenu.addSubMenu(""products"", ""products"&mAlldata(2,mIndex)&""", """&menuprestr&replace(mAlldata(3,mIndex),"""","\""")&menupoststr&""", ""categories.asp?id="&mAlldata(2,mIndex)&""");"&vbCrLf
end if
NEXT
end if
FOR mIndex=0 TO ubound(mAlldata,2)
response.write "mymenu.addSubMenu(""products"
if mSubCats then response.write mAlldata(2,mIndex)
response.write """, """", """&menuprestr&Replace(mAlldata(1,mIndex),"""","\""")&menupoststr&""", ""products.asp?id="&mAlldata(0,mIndex)&""");"&vbCrLf
NEXT
end if
on error goto 0
%>