ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - Only Showing Categories with items associated
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Only Showing Categories with items associated

 Post Reply Post Reply
Author
Message
terencef View Drop Down
Newbie
Newbie


Joined: 04-May-2008
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote terencef Quote  Post ReplyReply Direct Link To This Post Topic: Only Showing Categories with items associated
    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

Back to Top
Hamish View Drop Down
Admin Group
Admin Group


Joined: 12-October-2006
Location: United Kingdom
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hamish Quote  Post ReplyReply Direct Link To This Post 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. 
Back to Top
Greg Dinger View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers
Avatar

Joined: 23-September-2006
Location: United States
Status: Offline
Points: 238
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greg Dinger Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
terencef View Drop Down
Newbie
Newbie


Joined: 04-May-2008
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote terencef Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
terencef View Drop Down
Newbie
Newbie


Joined: 04-May-2008
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote terencef Quote  Post ReplyReply Direct Link To This Post Posted: 15-March-2009 at 1:22am
Sorry it's late - make that "items that are mapped to categories"
Back to Top
ProductCart View Drop Down
Admin Group
Admin Group

ProductCart Team

Joined: 01-October-2003
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote ProductCart Quote  Post ReplyReply Direct Link To This Post 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 shopping cart software
Back to Top
Greg Dinger View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers
Avatar

Joined: 23-September-2006
Location: United States
Status: Offline
Points: 238
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greg Dinger Quote  Post ReplyReply Direct Link To This Post 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
 
Terence - is there a reason you don't want to just hide them as EI is proposing?
Back to Top
terencef View Drop Down
Newbie
Newbie


Joined: 04-May-2008
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote terencef Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Greg Dinger View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers
Avatar

Joined: 23-September-2006
Location: United States
Status: Offline
Points: 238
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greg Dinger Quote  Post ReplyReply Direct Link To This Post Posted: 15-March-2009 at 3:12pm
Look at you!  Good on ya!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.