Print Page | Close Window

Product count per category

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=606
Printed Date: 06-October-2024 at 8:38am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Product count per category
Posted By: ClarkSmith
Subject: Product count per category
Date 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)
Cleaner 1
Cleaner 2
Cleaner 3
Protect (1 product)
Protector 1
Transform (0 products)
Sinks (4 products inside)
Cleaners (4 products)
Cleaner 1
Cleaner 2
Cleaner 3
Cleaner 4

Thanks in advance for any help!




Replies:
Posted By: NWilliams
Date Posted: 28-January-2007 at 9:39pm
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.


Posted By: ClarkSmith
Date Posted: 29-January-2007 at 8:12am
Thanks for taking the time, I'll give that a shot.

-------------
Professional-grade cleaning products for the home and building. http://www.clarksmith.biz



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net