![]() |
Only Showing Categories with items associated |
Post Reply ![]() |
Author | |
terencef ![]() Newbie ![]() Joined: 04-May-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Hamish ![]() Admin Group ![]() Joined: 12-October-2006 Location: United Kingdom Status: Offline Points: 56 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
Greg Dinger ![]() Certified ProductCart Developers ![]() ![]() Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
terencef ![]() Newbie ![]() Joined: 04-May-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
terencef ![]() Newbie ![]() Joined: 04-May-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
Sorry it's late - make that "items that are mapped to categories"
|
|
![]() |
|
ProductCart ![]() Admin Group ![]() ProductCart Team Joined: 01-October-2003 Status: Offline Points: 135 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
Greg Dinger ![]() Certified ProductCart Developers ![]() ![]() Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
![]() ![]() ![]() ![]() ![]() |
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
Terence - is there a reason you don't want to just hide them as EI is proposing?
|
|
![]() |
|
terencef ![]() Newbie ![]() Joined: 04-May-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
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.descriptionFROM dbo.categories INNER JOINdbo .categories_products ON dbo.categories.idCategory = dbo.categories_products.idCategory INNER JOINdbo .products ON dbo.categories_products.idProduct = dbo.products.idProductORDER BY dbo.categories.idCategory, dbo.categories.idParentCategory |
|
![]() |
|
Greg Dinger ![]() Certified ProductCart Developers ![]() ![]() Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
![]() ![]() ![]() ![]() ![]() |
Look at you! Good on ya!
|
|
![]() |
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 |