Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default changing Categories to Unordered nested list

    I'm having *quite* a time getting this done. I've been editing the tpl_categories.php file for hours now. I keep coming *sooo* close to accomplishing this, but it's just out of my reach. This is as far as I seem to be able to get (not the whole thing, but the relevant section):

    Code:
          case ($box_categories_array[$i]['top'] == 'true'):
            $new_style = 'category-top';
            break;
          case ($box_categories_array[$i]['has_sub_cat']):
            $new_style = 'category-subs';
            break;
          default:
            $new_style = 'category-products';
          }
         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 {
    
          //$content .= '<li><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 .= '<li><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
              $content .= $box_categories_array[$i]['name'] . '</a>' . "\n" . '<ul>' . "\n";
          }
            } else if ($box_categories_array[$i]['top'] !=='true') {        
    
            } else {
    
    	  $content .= '<li><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
              $content .= $box_categories_array[$i]['name'] . '</a></li>' . "\n";
    	} 
    
          if (SHOW_COUNTS == 'true') {
            if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
              $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
            }
    
          } 
    
    	 if ($box_categories_array[$i]['top'] !=='true') { 
    	$content .= '<li><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">' . $box_categories_array[$i]['name'] . '</a></li>' . "\n";
    
          } 
    
      }
    
    }
    	$content .='</ul>'."\n";
    
      if (SHOW_CATEGORIES_BOX_SPECIALS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_NEW == 'true' or SHOW_CATEGORIES_BOX_FEATURED_PRODUCTS == 'true' or SHOW_CATEGORIES_BOX_PRODUCTS_ALL == 'true') {
    // display a separator between categories and links
        if (SHOW_CATEGORIES_SEPARATOR_LINK == '1') {
          $content .= '<hr id="catBoxDivider" />' . "\n";
        }
    and this is what it outputs:

    HTML Code:
    <ul class="sideBoxContent">
    <li><a class="category-top" href="http://localhost/zencart/index.php?main_page=index&amp;cPath=1">Greece</a>
    <ul>
    <li><a class="category-products" href="http://localhost/zencart/index.php?main_page=index&amp;cPath=1_6">People</a></li>
    <li><a class="category-products" href="http://localhost/zencart/index.php?main_page=index&amp;cPath=1_7">Scenics</a></li>
    <li><a class="category-top" href="http://localhost/zencart/index.php?main_page=index&amp;cPath=2">Landscapes & Scenics</a></li>
    <li><a class="category-top" href="http://localhost/zencart/index.php?main_page=index&amp;cPath=3">Flowers & Leaves</a></li>
    
    <li><a class="category-top" href="http://localhost/zencart/index.php?main_page=index&amp;cPath=4">Abstracts</a></li>
    <li><a class="category-top" href="http://localhost/zencart/index.php?main_page=index&amp;cPath=5">Animals</a></li>
    </ul>
    As you can see, I have the list started, and I have the parent UL tag (for the categories with subs) - but I can't seem to find the place to put the closing ul and li tags for the sub cataegories and parents. It seems like it should be soooo simple - yet I can't seem to get it in there.

    Would anyone have any suggestions for me? Pretty please?

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,828
    Plugin Contributions
    9

    Default Re: changing Categories to Unordered nested list

    If you are attempting what I think your are there is a module to do this and most is done via CSS... you might have a look as you really do not need to hace the code so drastically, and it might give you some insight.

    See it here: Module
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: changing Categories to Unordered nested list

    Thanks Kobra :)

    I'll look at this module - maybe it'll give me some ideas. I'm not looking for a flyout menu, though - I just want to convert the sidebar menu to a nested list, nothing more :)

    But thank you -and I'll report back with my findings :)

  4. #4
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: changing Categories to Unordered nested list

    OMG Kobra - I could *kiss* you! I ued that module (sans the stylesheet and images stuff) and it does *exactly* what I need it to do. You are my hero for the day...you have *no* idea how much you have helped me!

    Yay!

  5. #5
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,292
    Plugin Contributions
    1

    Default Re: changing Categories to Unordered nested list

    Although it may not the info for this thread now, find that you are discussing moding categories menu sidebox, and also discussing in other thread for the display of categories and subcategories.

    Please refer to the topics below for more references.
    And hope that you find the solutions and share with up.

    Yahootreemenu with ajax.
    The mod now only use the basic tree menu of yahoo yui. However, if you have time you may change it to other menus of the yui for more functions.

    always display subcategories in sidebox
    A simple mod and always open up the categories and subcategories. In the above thread of yahoo yui mod also disscussed about this functions and provided with solution.

    Category Groups Sidebox - downloadable
    Another approach to mod the categories menu sidebox
    A New Starter again

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,828
    Plugin Contributions
    9

    Default Re: changing Categories to Unordered nested list

    seethrou,

    Nice one there...I had not read closely enough and this may be more inline with what OP was looking for.

    Guess I have to slow down and read postings more carefully...
    Zen-Venom Get Bitten

 

 

Similar Threads

  1. v139h slow store due to large amount of nested Categories
    By ballyc27 in forum General Questions
    Replies: 21
    Last Post: 3 Jun 2012, 10:43 PM
  2. Customising unordered list syle
    By pework in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 27 Mar 2011, 01:30 PM
  3. Categories menu (netseted) as UL / Unordered List
    By rajoo.sharma in forum General Questions
    Replies: 0
    Last Post: 3 Sep 2009, 08:48 AM
  4. Category Tabs - Create nested list of Cats & Subcats
    By evamike in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 27 Aug 2009, 10:35 PM
  5. Is the Categories Sidebox an Unordered List?
    By pholli4 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 6 Feb 2008, 03:38 AM

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