Product count per category |
Post Reply |
Author | |
ClarkSmith
Newbie Joined: 20-January-2007 Status: Offline Points: 0 |
Post Options
Thanks(0)
Posted: 20-January-2007 at 12:30pm |
Can anyone offer a snippet of code that would allow counts of products per category? I use categories heavily but don't have products for every category yet. So a user may dig four or five steps deep only to find there is nothing there. The count needs to be able to show total products in all subcategories as well in order to prevent people from clicking deeply into a category structure only to find nothing. It would look like this:
Bathroom Floors Clean (3 products) Protect (1 product) Transform (No products yet available) Structurally it would be thinking like this: Bathrooms (8 products inside) Floors (4 products inside) Clean (3 products) Sinks (4 products inside)Cleaner 1 Protect (1 product)Cleaner 2 Cleaner 3 Protector 1 Transform (0 products)Cleaners (4 products) Cleaner 1 Cleaner 2 Cleaner 3 Cleaner 4 Thanks in advance for any help! |
|
NWilliams
Newbie Joined: 19-November-2006 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
|
Perform a select statement that would return all products in a category and use the Recordset.Recordcount property to retrieve the number of results in the recordset.
You should be able to poke around in some of the source and copy and paste code that would do the trick with minor editing. To do what you're wanting, I would edit the GenerateNavigation.asp file to just not add the category to the navigation code if there are no products in its category or subcategories. Rather complex, but I think it'd be the most user-friendly solution so long as you don't list subcategories from the view of a parent category. Edited by NWilliams - 28-January-2007 at 9:41pm |
|
ClarkSmith
Newbie Joined: 20-January-2007 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
Thanks for taking the time, I'll give that a shot.
|
|
Professional-grade cleaning products for the home and building. http://www.clarksmith.biz
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |