Ok, I finally figured it all out. Incase anyone else wants to do something similar, here is what I did:
!!!PLEASE MAKE BACKUPS OF ANY FILES YOU ARE GOING TO CHANGE SO THAT IT IS EASY FOR YOU TO REVERT BACK TO ORIGINALS IF YOU DON'T LIKE THE CHANGE!!!
1. I copied the GenerateCategoryLinks sub from shopdisplaycategories.asp into its own file, and saved it as generatecategorylinks.asp. I modified the sub slightly so that:
- All the required variables are declared
- The current page in the category links will not have a link, since that would just be redundant
The code looks like this:
<%
Sub GenerateCategoryLinks
dim mylink
dim highercategoryid
highercategoryid=request("id")
If not isnumeric(highercategoryid) then
highercategoryid=""
end if
dim highercatid, cats(10),catids(10), i
dim cathead, more, catsql, rs
dim id,name
highercatid=highercategoryid
cathead=""
catsql="select * from categories where categoryid=" & highercatid
Set rs=dbc.execute(catsql)
highercatid=rs("highercategoryid")
name=rs("catdescription")
id=rs("categoryid")
i=0
More=True
if highercatid=0 then
mylink=name
cats(i)=mylink
i=i+1
more=false
else
mylink=name
cats(i)=mylink
i=i+1
end if
Closerecordset rs
Do while more=True
catsql="select * from categories where categoryid=" & highercatid
Set rs=dbc.execute(catsql)
If not rs.eof then
highercatid=rs("highercategoryid")
name=rs("catdescription")
id=rs("categoryid")
mylink="<a HREF=""shopdisplaycategories.asp?id=" & highercatid & "&cat=" & Server.URLEncode(name) & """>" & name & "</a>"
cats(i)=mylink
i=i+1
if highercatid=0 then
more=false
end if
else
more=false
end if
Closerecordset rs
loop
For i = 0 to i-1
If cathead="" Then
cathead = cats(i)
else
cathead= cats(i) & subcatseparator & cathead
end if
next
response.write subcatheader & cathead & subcatheaderend
end sub
%>
2. After I did that, I removed the GenerateCategoryLinks sub from shopdisplaycategories.asp, and added the following include to shopdisplaycategories.asp and shopdisplayproducts.asp:
<!--#include file="generatecategorylinks.asp"-->
3. Next, I found the line in shopdisplayproducts.asp that generated the current category text on top of the page. It looks like this:
response.write prodheaderfont & header & prodheaderfontend'
I commented that line out, and replaced it with:
GenerateCategoryLinks
Edited by - alla on March 03 2004 14:34:08