Author |
Topic |
|
jonmadrid
VP-CART New User
USA
192 Posts |
Posted - October 22 2003 : 23:20:22
|
I just solved a little snag I was having and thought I would share the solution with eveyrone here.
The problem was that some of my product categories have subcategories while others do not. I am using the categories drop down navigation/menulist (created by calling the NavigateShowAllCategories() sub) and it always sent users to the shopdisplayproducts.asp page, regardless of wether or not there were subcategories to disaply. In the cases where there were subcategories to display, I wanted to send the users to the shopdisplaycategories.asp page, rather than to a premature showing of all the products for the main category on the shopdisplayproducts.asp page. In essence, I didnt want the user to be shown all the products in the top-level categories, since there are so many products. I wanted them to be able to drill down through the subcategories to find what they were looking for. VP-ASP doesnt have an easy way to do that so I modified the shopproductsubs.asp and it works like a charm.
Here's what you do:
Around line 402 in shopproductsubs.asp, replace this:
****************** url="shopdisplayproducts.asp?id=" & cid & "&cat=" & server.urlencode(category) ******************
with this:
****************** ShopOpenDatabase catdbc Dim subcatcheckSQL,subcatcheckRS,strPageName subcatcheckSQL= "SELECT Count(categories.categoryid) AS catcount FROM categories WHERE (categories.highercategoryid)=" & cid &";"
set subcatcheckRS=catdbc.execute(subcatcheckSQL) if subcatcheckRS("catcount") > 0 Then strPageName = "shopdisplaycategories.asp" else strPageName = "shopdisplayproducts.asp" end if
ShopCloseDatabase catdbc
url="" & strPageName & "?id=" & cid & "&cat=" & server.urlencode(category) ******************
In a nut-shell, what this does is checks if there are subcategories for the top-level categories that are being displayed in the menulist. The user will be directed to the appropriate page based on the presence/absence of subcategories for each of the top-level categories.
You can see what I mean at www.azdiscountgolf.com. Use the "Product Categories" drop down menu to navigate and you will be taken to the approporiate pages (shopdisplaycategories.asp or shopdisplayproducts.asp, depeninding on whether or not there are subcategories for that category).
It's a minor thing but it makes getting around the site a little easier. I hope it's of help to some of you.
All the best,
Jon Madrid -------------------- Madrid Communications Web Design, Development, and Hosting www.madridcom.com
|
|
tikidawn
Starting Member
USA
4 Posts |
Posted - October 30 2003 : 11:41:50
|
Jon,
Your description of what this code is to do seems to be exactly what I need. But each time I've tried the code replacement in shopproductsubs.asp I just get this error code on my site:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/vpaspplus/shopproductsubs.asp, line 404
Dim subcatcheckSQL,subcatcheckRS,strPageName subcatcheckSQL= "SELECT Count(categories.categoryid) AS catcount FROM categories WHERE (categories.highercategoryid)=" & cid &";" ---------------------------------------------^
Is anyone else having this problem? And a solution?
Thanks in advance,
Tina Kincaid
|
|
|
masha
Starting Member
USA
8 Posts |
Posted - October 30 2003 : 14:28:40
|
One of the variables is defined twice on the second line of code.
Change: Dim subcatcheckSQL,subcatcheckRS,strPageName subcatcheckSQL= "SELECT Count(categories.categoryid) AS catcount FROM categories WHERE (categories.highercategoryid)=" & cid &";"
To: Dim subcatcheckSQL,subcatcheckRS,strPageName subcatcheckSQL="SELECT Count(categories.categoryid) AS catcount FROM categories WHERE (categories.highercategoryid)=" & cid &";"
That worked for me.
|
|
|
rodney
VP-CART New User
USA
75 Posts |
Posted - November 04 2003 : 22:07:04
|
Jon,
Hey carry to share out you got both left and right navigation on the golf site?
-Rodney Web Site Now Technologies, LPP |
|
|
jonmadrid
VP-CART New User
USA
192 Posts |
Posted - November 05 2003 : 12:49:39
|
Rodney,
I can give you the basic descritpion of how I accomplished that. (For anyone wondering what we are talking about, you can see the left and right nav columns here: http://www.azdiscountgolf.com)
Here it goes:
First of all, the left column nav is part of the page header, and the right column nav is part of the footer. For the left include file there are several "areas": Search, Quick Links, Customer Login, Featured Products, and Best Sellers. On the right include file there are Newest Additions, Specials and Vendors. The left side is an include within the page header file and the right side is an include in the page footer file. Then, each of the "areas" (Quick Links, Featured Products, etc) are individual files that were then included in the left/right include files. So, what you end up with is includes inside an include. That wasnt necessary but I did that so that I could have more control over the entire colum in one shot. For example, there are places on the site where I have the right colum turned off. I simply defined that in the right column file and obvisouly when it goes away, so do all the child includes.
These menus have proven to be VERY helpful and the dynamic elements of them add a nice touch of fresh content that I never have to update makin them even better for us.
Does that help give you an idea of how to do this? Please contct me directly if you would like further information: [email protected]
All the best,
Jon Madrid -------------------- Madrid Communications Web Design, Development, and Hosting www.madridcom.com
|
|
|
perryd
Starting Member
USA
9 Posts |
Posted - November 11 2003 : 22:30:31
|
quote:
I just solved a little snag I was having and thought I would share the solution with eveyrone here.
The problem was that some of my product categories have subcategories while others do not. I am using the categories drop down navigation/menulist (created by calling the NavigateShowAllCategories() sub) and it always sent users to the shopdisplayproducts.asp page, regardless of wether or not there were subcategories to disaply. In the cases where there were subcategories to display, I wanted to send the users to the shopdisplaycategories.asp page, rather than to a premature showing of all the products for the main category on the shopdisplayproducts.asp page. In essence, I didnt want the user to be shown all the products in the top-level categories, since there are so many products. I wanted them to be able to drill down through the subcategories to find what they were looking for. VP-ASP doesnt have an easy way to do that so I modified the shopproductsubs.asp and it works like a charm.
Here's what you do:
Around line 402 in shopproductsubs.asp, replace this:
****************** url="shopdisplayproducts.asp?id=" & cid & "&cat=" & server.urlencode(category) ******************
with this:
****************** ShopOpenDatabase catdbc Dim subcatcheckSQL,subcatcheckRS,strPageName subcatcheckSQL= "SELECT Count(categories.categoryid) AS catcount FROM categories WHERE (categories.highercategoryid)=" & cid &";"
set subcatcheckRS=catdbc.execute(subcatcheckSQL) if subcatcheckRS("catcount") > 0 Then strPageName = "shopdisplaycategories.asp" else strPageName = "shopdisplayproducts.asp" end if
ShopCloseDatabase catdbc
url="" & strPageName & "?id=" & cid & "&cat=" & server.urlencode(category) ******************
In a nut-shell, what this does is checks if there are subcategories for the top-level categories that are being displayed in the menulist. The user will be directed to the appropriate page based on the presence/absence of subcategories for each of the top-level categories.
You can see what I mean at www.azdiscountgolf.com. Use the "Product Categories" drop down menu to navigate and you will be taken to the approporiate pages (shopdisplaycategories.asp or shopdisplayproducts.asp, depeninding on whether or not there are subcategories for that category).
It's a minor thing but it makes getting around the site a little easier. I hope it's of help to some of you.
All the best,
Jon Madrid -------------------- Madrid Communications Web Design, Development, and Hosting www.madridcom.com
Perry Dau |
|
|
perryd
Starting Member
USA
9 Posts |
Posted - November 11 2003 : 22:33:24
|
This is right on target for what I want to do. However, I am using an access database. I assume that this changes the coding somewhat. Any input would be appreciated. Thanks Perry
Perry Dau |
|
|
jonmadrid
VP-CART New User
USA
192 Posts |
Posted - November 12 2003 : 12:18:21
|
Perry,
Nope. You shouldn't need to change anything at all. That code is actually intended for an Access database. Just be sure to make note of the slight change that Masha mentioned (above). The forum wrapped all the code into one line when I posted it originally. So, if you copied and pasted it, it would give you an error saying that a variable was defined twice. All you need to do is split one of the lines in order to fix that problem.
Let me know if you have any questions or if you can't get it to work.
All the best,
Jon Madrid -------------------- Madrid Communications Web Design, Development, and Hosting www.madridcom.com
|
|
|
|
Topic |
|