Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Not enough classes to style my sub sub sub menu items

Not enough classes to style my sub sub sub menu items

Locked

Views: 1,522

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
21 Mar 2008, 3:10 PM
#1
robgt avatar

robgt

New Zenner

Join Date:
Dec 2007
Posts:
27
Plugin Contributions:
0

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&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&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&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&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). :frusty:

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?:wacko:
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

21 Mar 2008, 3:28 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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.

21 Mar 2008, 3:56 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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.

21 Mar 2008, 5:12 PM
#4
robgt avatar

robgt

New Zenner

Join Date:
Dec 2007
Posts:
27
Plugin Contributions:
0

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

25 Mar 2008, 10:05 PM
#5
robgt avatar

robgt

New Zenner

Join Date:
Dec 2007
Posts:
27
Plugin Contributions:
0

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

As I suspected - Glenn to the rescue once again :D
Your post in that other thread (second option for any number of sub levels) worked perfectly for me.
:clap:
Many thanks!!
Cheers,
Rob