apswater
VP-CART Super User
444 Posts |
Posted - January 05 2006 : 14:48:45
|
I wrote this simple piece of code that make a master category index that is more fiendly to search engines for v 4.5.
Here is the output http://www.labwater.com/catindex.asp
To accomplish this......
1. Insert a link in your menu or header <a href=catindex.asp>Category Index</a>
Make a file in the root directory of vp-asp called catindex.asp insert this code
<!--#include file="shop$db.asp"--> <!--#include file="shopfileio.asp"-->
<!--#include file="shoppage_header.htm"--> <%NavigateShowallCategories%>
Then open shopproductsubs.asp and add this to the bottom (above the last %> )
Sub NavigateShowAllCategories() If getconfig("Xnavigatecategories")="No" then exit sub If getconfig("xlogonrequired")="Yes" then If getsess("login")="" then exit sub end if end if dim cid, name,catSQL,i dim strcategory, catcount, categories,maxcategories Dim catdbc,catrs, hassubcategory,mylink catcount=getsess("catcount") If catcount="" then catcount=0 If catcount=0 then catcount=0 maxcategories=getconfig("xmaxcategories") redim categories(maxcategories) ShopOpenDatabase catdbc catSQL="Select * from categories where cathide is null order by catdescription" set catrs=catdbc.execute(catsql) While Not catrs.EOF and catcount<maxcategories cid=catrs("categoryID") name=catrs("catdescription") hassubcategory=catrs("HasSubcategory") If isnull(hassubcategory) then hassubcategory="" end if if hasSubcategory ="" then mylink="<a HREF=""shopdisplayproducts.asp?id=" & cid & "&cat=" & Server.URLEncode(name) & """>" & name & "</a>" else mylink="<a HREF=""shopdisplaycategories.asp?id=" & cid & "&cat=" & Server.URLEncode(name) & """>" & name & "</a>" end if categories(catcount)=mylink catcount=catcount+1 catrs.MoveNext Wend setsess "categories",categories setsess "catcount",catcount catrs.Close set catrs=nothing ShopCloseDatabase catdbc end if ' catcount=getsess("catcount") categories=getsess("categories") response.write "<b><font size=2 color=black face=arial>Product Category Index <hr></font><font face=arial size=1>" 'response.write NavCatTable for i = 0 to catcount-1 mylink=categories(i) 'response.write NavCatRow & NavCatColumn response.write "<br> " response.write mylink 'response.write NavCatColumnend next response.write "</table>" exit sub end sub
|
Edited by - apswater on January 05 2006 17:46:30 |
|