Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2008
    Posts
    7
    Plugin Contributions
    0

    Default Limit categories displayed in header??

    As I add categories I do not want them all displayed at the base of the header: I would like to keep the header clean with just two or three chosen categories displaying (I don't want to turn off the whole display in admin), and provide the extensive listing in the sidebox only. Can I do this? Where is the code which inserts categories into the header??

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

    Default Re: Limit categories displayed in header??

    The easiest thing for you may be to turn off the cat-tabs bar and add the categories you want as internal ez-page links, and use the ez-pages header nav.
    Can you give a link to your site so we can see what you have?

  3. #3
    Join Date
    Sep 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Limit categories displayed in header??

    I see where you're going with this, and sort-of like it as a workaround solution. I also greatly appreciate the input!! Still wish I knew where the code lives which places the categories in the header though, even if only for my own edification. Here's my site if you're curious: I'm obviously still not comfortable with EZ-Pages, but could easily place other code to do the job as you suggest. Thanks again!

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

    Default Re: Limit categories displayed in header??

    /includes/modules/your_template/categories_tabs.php would be the place to edit the cat-tabs.
    You could add a test inside the while loop to skip the contents unless the cat being processed matched one of the ones you want to display.
    PHP Code:
    while (!$categories_tab->EOF) {

      
    // currently selected category
      
    if ((int)$cPath == $categories_tab->fields['categories_id']) {
        
    $new_style 'category-top';
        
    $categories_tab_current '<span class="category-subs-selected">' $categories_tab->fields['categories_name'] . '</span>';
      } else {
        
    $new_style 'category-top';
        
    $categories_tab_current $categories_tab->fields['categories_name'];
      }

      
    // create link to top level category
      
    $links_list[] = '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' $categories_tab_current '</a> ';
      
    $categories_tab->MoveNext();


  5. #5
    Join Date
    Sep 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Limit categories displayed in header??

    Thanks Glenn - exactly what I was looking to do ... for hours before giving up! You don't know how much I appreciate all your help on this forum: why I love my zen-cart is you all helpful followers. All I can do is html and css - but this is the first time I couldn't pull through my php lameness without making a post.

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

    Default Re: Limit categories displayed in header??

    I didn't want to be redundant if you already knew what to do, but try this:
    PHP Code:
    while (!$categories_tab->EOF) {

      if ((
    $categories_tab->fields['categories_id'] == 23) or ($categories_tab->fields['categories_id'] == 37)) { //process output for these categories only
        // currently selected category
        
    if ((int)$cPath == $categories_tab->fields['categories_id']) {
          
    $new_style 'category-top';
          
    $categories_tab_current '<span class="category-subs-selected">' $categories_tab->fields['categories_name'] . '</span>';
        } else {
          
    $new_style 'category-top';
          
    $categories_tab_current $categories_tab->fields['categories_name'];
        }

        
    // create link to top level category
        
    $links_list[] = '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' $categories_tab_current '</a> ';
      } 
    //process 
      
    $categories_tab->MoveNext();

    Change 23 and 37 to the category ids you want to display, and add another "or (...)" to the list if needed.

  7. #7
    Join Date
    Sep 2008
    Posts
    7
    Plugin Contributions
    0

    Default Re: Limit categories displayed in header??

    ok ... well I tried that code in categories_tabs, but all the categories went away, as would be done in admin. I then tried every combination and permutation I could think of, along similar lines, and got one of two results: either the categories all went away, or code-confusion reigned and after a very-slow-load the entire page after the header went light blue sans information. I now suspect that fields are defined elsewhere - or differently - and that calling them out here results in mayhem. Ideas???

 

 

Similar Threads

  1. Is there a way to limit the quantity displayed?
    By rubbercarp in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 15 Mar 2010, 06:58 PM
  2. Limit Number of Products Displayed
    By rlitman in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 Apr 2008, 06:23 PM
  3. How to limit number of categories displayed on main page
    By MyGreyGoose in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 11 Feb 2008, 08:38 AM
  4. Limit # of sub categories displayed
    By ryan656 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 27 Nov 2007, 11:25 AM

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