VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-ASP Shopping Cart Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VPCart Forum
 Customization
 Code contribution - Category Navigation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jonmadrid
VP-ASP New User

USA
192 Posts

Posted - October 22 2003 :  23:20:22  Show Profile  Visit jonmadrid's Homepage  Reply with 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




tikidawn
Starting Member

USA
4 Posts

Posted - October 30 2003 :  11:41:50  Show Profile  Reply with Quote
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


Go to Top of Page

masha
Starting Member

USA
8 Posts

Posted - October 30 2003 :  14:28:40  Show Profile  Reply with Quote
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.


Go to Top of Page

rodney
VP-ASP New User

USA
75 Posts

Posted - November 04 2003 :  22:07:04  Show Profile  Reply with Quote
Jon,

Hey carry to share out you got both left and right navigation on the golf site?

-Rodney
Web Site Now Technologies, LPP
Go to Top of Page

jonmadrid
VP-ASP New User

USA
192 Posts

Posted - November 05 2003 :  12:49:39  Show Profile  Visit jonmadrid's Homepage  Reply with Quote
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



Go to Top of Page

perryd
Starting Member

USA
8 Posts

Posted - November 11 2003 :  22:30:31  Show Profile  Reply with Quote
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
Go to Top of Page

perryd
Starting Member

USA
8 Posts

Posted - November 11 2003 :  22:33:24  Show Profile  Reply with Quote
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
Go to Top of Page

jonmadrid
VP-ASP New User

USA
192 Posts

Posted - November 12 2003 :  12:18:21  Show Profile  Visit jonmadrid's Homepage  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000