Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2009
    Posts
    24
    Plugin Contributions
    0

    Default HOW TO Show only current category in categories sidebox?

    Mods - please leave this up as it took me two days of searching to find this post and there were many unanswered questions asking for the same thing!

    Guys, I took this from the '3 separated category boxes' thread. It's a simple mod that tells your categories box to display only the subcategories of the category you selected (are navigating to) - enjoy!

    Credit goes to Glen for this one - my heartfelt thanks - I can now get some sleep!

    --------------------------------------------------------------------------

    In /includes/templates/your_template/sideboxes/tpl_categories.php, find this
    PHP Code:
    if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
    // skip if this is for the document box (==3)
    } else {
    and add

    substr_count($box_categories_array[$i]['path'],'_') == 0 or

    to the if test to get this
    PHP Code:
    // subcat limit 2007-12-20
    if (substr_count($box_categories_array[$i]['path'],'_') == 0 or zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
    // skip if this is for the document box (==3)
    } else {
    The number of underscores in $box_categories_array[$i]['path'] indicates the category level, with 0 being a top cat.

    The code can also be used to hide lower level subcats, with

    $box_categories_array[$i]['path'] > 1

    For more discussion of this, see the original thread Hide top category - Skip to subcategories.
    ##############################___
    Glenn . . . Future Relics Jewelry, NY Faerie Festival
    Categories Dressing, Images for Titles, Smart Backgrounds, Additional Img Titles, Ezpages Footer Columns, Model List...

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,013
    Plugin Contributions
    25

    Default Re: HOW TO Show only current category in categories sidebox?

    Since the time of that post, I have developed Categories Dressing to have the ability to choose this and several other display modes without editing code in PHP files, just putting a few numbers in a define file. If you only want the bare "hide top cats" functionality, the posted code still works fine.

 

 

Similar Threads

  1. Category Sidebox: 3rd level categories will not show
    By mteipe in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 6 Jan 2010, 03:50 AM
  2. Replies: 0
    Last Post: 5 May 2009, 03:10 PM
  3. Current Category Product List Sidebox
    By Aetherlux in forum Addon Sideboxes
    Replies: 1
    Last Post: 21 Feb 2009, 12:03 AM
  4. Replies: 2
    Last Post: 7 Sep 2008, 03:27 PM
  5. How do I seperate Current Category and it's sub-categories?
    By weber in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 7 Jun 2007, 07:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •