Print Page | Close Window

Only Showing Categories with items associated

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=2556
Printed Date: 23-July-2025 at 4:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Only Showing Categories with items associated
Posted By: terencef
Subject: Only Showing Categories with items associated
Date Posted: 14-March-2009 at 7:50am

Hi; has anyone implemented a category navigation system that ONLY shows categories that have items associated.

Would appreciate some pointers. I looked at the Wiki code, but that's not what I need.

Thanks in advance




Replies:
Posted By: Hamish
Date Posted: 14-March-2009 at 8:17pm
Hi Terence,
   Can you explain in more detail? Do you mean the navigation that can be generated from the admin pages?

If you have categories you do not wish to show in the store front you can select "Hide this category in the storefront" in the "other settings" tab when modifying/creating the category. 

-------------
Editing ProductCart Code?

See http://wiki.earlyimpact.com/developers/editcode" rel="nofollow - WIKI Guidelines for Editing ProductCart's ASP Source Code



Posted By: Greg Dinger
Date Posted: 14-March-2009 at 8:26pm
The way the category navigation works is that it generates a link for every category regardless of whether the store has prouducts or not.  You drill down through such empty categories, only to find nothing.
 
The solution to what  he is asking, it occurs to me, is to alter the query so that it detects only categories that have products assigned to them.  Hiding the categories may work as well.


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: terencef
Date Posted: 15-March-2009 at 1:21am
That is correct Greg - I want to show dynamically only the categories  that are mapped to categories; if there are no items of a category they are not displayed.
 
There's really no sense in having someone click on a category and go down 2 levels to find no items.
 
Also we will be updating the items via the database on a nightly basis, and don't want to use the admin interface to hide/unhide the categories.
 
Thanks


Posted By: terencef
Date Posted: 15-March-2009 at 1:22am
Sorry it's late - make that "items that are mapped to categories"


Posted By: ProductCart
Date Posted: 15-March-2009 at 7:01am
There is always a reason behind virtually every behavior in ProductCart. Sometimes category pages are used as content pages. In that case, they indeed make sense even if no products have been assigned. That's why the software behaves the way it does.

Of course, the SQL queries could certainly be modified as indicated by Greg above. Hiding the category works even better since no code changes would be required.


-------------
The ProductCart Team

Home of ProductCart http://www.productcart.com" rel="nofollow - shopping cart software


Posted By: Greg Dinger
Date Posted: 15-March-2009 at 12:39pm
That's a really good point.  Here is an example where a client used the category page as a content page http://www.euphoriababy.com/store/pc/Cloth-Diaper-Packages-c148.htm - http://www.euphoriababy.com/store/pc/Cloth-Diaper-Packages-c148.htm
 
Terence - is there a reason you don't want to just hide them as EI is proposing?


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: terencef
Date Posted: 15-March-2009 at 3:05pm

Thanks for the info - I understand there are reasons and that's not a problem. Thanks for the pointers and the offers. I've figured out the SQL for the dynamic category tree:

SELECT dbo.categories.idCategory, dbo.categories.idParentCategory, dbo.categories.categoryDesc, dbo.categories.priority, dbo.products.sku, dbo.products.description

FROM dbo.categories INNER JOIN

dbo.categories_products ON dbo.categories.idCategory = dbo.categories_products.idCategory INNER JOIN

dbo.products ON dbo.categories_products.idProduct = dbo.products.idProduct

ORDER BY dbo.categories.idCategory, dbo.categories.idParentCategory



Posted By: Greg Dinger
Date Posted: 15-March-2009 at 3:12pm
Look at you!  Good on ya!

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |



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