Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Posts
    27
    Plugin Contributions
    0

    Default Not enough classes to style my sub sub sub menu items

    I've run into a problem with category styling.
    I've removed the spacing in the admin system which pads category text in from the left as it makes long category names wrap around to the hard left edge of the container and looks bad.

    I decided to style the categories using CSS instead, padding each sub level in a little more than it's parent element.
    The trouble is that there doesn't appear to be enough classes defined in the rendered menu.
    Let me explain...

    Here is an example of code from one section of my menu - it forms a tree structure from top level down to bottom level (or it should):

    <a class="category-top-text" href="http://www.domain.co.uk/test12/index.php?main_page=index&amp;cPath=217"><span class="category-subs-parent">Top level menu item</span></a><br />

    <a class="category-subs-text" href="http://www.domain.co.uk/test12/index.php?main_page=index&amp;cPath=217_281"><span class="category-subs-parent">Second level menu item</span></a><br />

    <a class="category-subs-text" href="http://www.domain.co.uk/test12/index.php?main_page=index&amp;cPath=217_281_283"><span class="category-subs-parent">Third level menu item</span></a><br />

    <a class="category-products-text" href="http://www.domain.co.uk/test12/index.php?main_page=index&amp;cPath=217_281_283_307"><span class="category-not-selected">Products listing menu item</span></a>


    Hopefully, you can see that the Second level menu item AND the third level menu item have exactly the same classes applied to their A and SPAN tags.

    a.category-subs-text then span.category-subs-parent

    This means that I cannot inset the Third level menu item under it's parent (Second level menu item).

    The other issue I'm having is that some of the Second level menu items are product listing menu items as they do not have any sub categories inside them, and will display a product listing when clicked. This means that they will take on the padding of the product listing menu item shown above (4th level inset menu item).

    a.category-products-text then span.category-not-selected

    This level should look, and be positioned, the same as Second level menu item.

    I'm a bit lost as to how this can be resolved?
    The client can't change the structure because it's totally logical as it is, and I can't seem to see a way of styling the available classes to get the display heirarchy looking right for each category and it's sub level elements?

    Once again, sorry I cannot post a URL to this development site...
    Any help or guidance much appreciated.
    Cheers,
    Rob

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

    Default Re: Not enough classes to style my sub sub sub menu items

    You'll need to add some code to tpl_categories.php (or whatever is the corresponding filename for the mod you are using) to detect the subcat level of each item.

    If your mod doesn't include an array element for that, you can get it by counting the underscores in the cPath ($box_categories_array[i]['path'] in the standard system; you may have a different variable to hold this info).

    The number of underscores equals the subcat level. You can use this to build a class name for the item.

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

    Default Re: Not enough classes to style my sub sub sub menu items

    The Changing color of Categories and Sub-Categories thread (post 20) gives simple directions for doing this. You might need to adapt it for your mod.

  4. #4
    Join Date
    Dec 2007
    Posts
    27
    Plugin Contributions
    0

    Default Re: Not enough classes to style my sub sub sub menu items

    Thanks again Glenn!
    I'll look into this later :)

    Almost there now I think!
    Cheers,
    Rob

  5. #5
    Join Date
    Dec 2007
    Posts
    27
    Plugin Contributions
    0

    Default Re: Not enough classes to style my sub sub sub menu items

    As I suspected - Glenn to the rescue once again
    Your post in that other thread (second option for any number of sub levels) worked perfectly for me.

    Many thanks!!
    Cheers,
    Rob

 

 

Similar Threads

  1. v150 How to display Top Cat & Sub Cat but not Sub Sub Cats??
    By spiggles87 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 5 Mar 2013, 06:37 PM
  2. v150 sub categories not showing up when click sub categores
    By asdfwen in forum Basic Configuration
    Replies: 4
    Last Post: 13 May 2012, 07:52 AM
  3. Replies: 1
    Last Post: 12 Mar 2011, 07:18 AM
  4. Millions of Attributes or hacking a Sub sub sub Category?
    By liquidpictures in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 12 Aug 2009, 02:25 PM
  5. How to NOT display sub sub category images?
    By magneteye in forum General Questions
    Replies: 19
    Last Post: 11 Apr 2009, 05:09 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