Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2012
    Posts
    5
    Plugin Contributions
    0

    Default Show Subcategories under Category Tabs

    Hello,

    Been researching posts for sometime trying to figure out how to make what I want work to no avail.

    I am using the Category Tab Simple Dropdown Menu mod.

    I have all sideboxes disabled and am only using the category tabs for navigation.

    What I want to do is have all of the subcategories shown directly below the main categories dependent upon which main category is the lead category.

    Example.
    If I have:
    Cat1, Cat2
    Under Cat1: A, B, C
    Under Cat2: D, E, F

    If someone clicks on Cat1 or A or B or C. I would like all of the sub categories listed under the main category line.

    Does that make sense?

    Thanks for any ideas. Everything I have found in the forum is all about the category sideboxes which I am not using so it was hard to cross reference.

    Thanks much for any input!

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

    Default Re: Show Subcategories under Category Tabs

    So you want essentially sidebox behavior... with the full tree of whatever top cat is in the cPath. I doubt the dropdown mods have the selectors built in for that, but it should be possible to add them with some extra PHP lookup and processing. Then you could make style rules to override the dropdown functionality and make children of the active top cat always display.

  3. #3
    Join Date
    Mar 2012
    Posts
    5
    Plugin Contributions
    0

    Default Re: Show Subcategories under Category Tabs

    Thanks for the reply!

    Yes that is exactly what I want. Do you think it would be easier to copy the sidebox code to the tabs file and modify the styles?

    Any direction on where I should start?

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Show Subcategories under Category Tabs

    The dropdowns are already set up to work correctly in that orientation, so it would probably be simpler to just pull in the lookup code from a sidebox file. This would only be a few lines, depending on what information is already available to the dropdown.

  5. #5
    Join Date
    Mar 2012
    Posts
    5
    Plugin Contributions
    0

    Default Re: Show Subcategories under Category Tabs

    I am having a hard time determining which lines of code in the category sidebox is used for lookup. I am thinking it is somewhere in this section but am unsure how to implement it into the dropdown.

    I am fairly familiar with PHP but it's been a while.

    PHP Code:
    if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
            
    // skip if this is for the document box (==3)
          
    } else {
           
    $content .= '<div class="betterCategories"><a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT$box_categories_array[$i]['path']) . '">';
          if (
    $box_categories_array[$i]['current']) {
            if (
    $box_categories_array[$i]['has_sub_cat']) {
              
    $content .= '<span class="category-subs-parent">';
              
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'down'$spacer);
              
    $content .= '</span>';
            } else {
              
    $content .= '<span class="category-subs-selected">';
              
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'nosub'$spacer);
              
    $content .= '</span>';
            }
          } else {
            if (
    $box_categories_array[$i]['has_sub_cat']) { 
            
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'right'$spacer); }
            else { 
            
    $content .= cat_with_pointer($box_categories_array[$i]['name'], 'nosub'$spacer); }
          }

          if (
    $box_categories_array[$i]['has_sub_cat']) {
            
    $content .= CATEGORIES_SEPARATOR;
          } 

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Show Subcategories under Category Tabs

    if ($box_categories_array[$i]['current']) {

    This is the line that fetches the active status for the sidebox (same array for stock sidebox or betterCategories), though I don't know if that array is used for the dropdown menu you are using. If it is not, then you will have to go deeper and figure out the status by comparing elements of $cPath with the category id being processed. There is code for that in several of my mods in Free Addons; Smart Backgrounds might have the simplest version of it.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Show Subcategories under Category Tabs

    PHP Code:
    $current '';
    if (
    in_array((/*id of category being processed - use the variable that gives this*/),explode('_',$_GET['cPath']))) $current ' class="current"';
    //insert $current into the <li> tag. 
    //if there is already a potential class attribute being inserted there, modify the code above to only give ' current ' as the value of $current. 

 

 

Similar Threads

  1. Category to show products in subcategories
    By apogeerockets in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 30 Jan 2016, 02:28 PM
  2. v151 Show all products in a category and subcategories
    By val-ent in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 24 Sep 2013, 10:32 AM
  3. Hide Toplevel category but show subcategories
    By JDAhlbom in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 13 Dec 2011, 09:55 PM
  4. Category Sidebox - Only Show Subcategories
    By kidsstuff in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 25 Oct 2010, 07:56 AM
  5. Show list of subcategories in category page
    By vooboo13 in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 16 Dec 2009, 06:48 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR