Forums / Basic Configuration / how would I make the categories expand?

how would I make the categories expand?

Locked

Views: 19,759

Results 41 to 57 of 57
This thread is locked. New replies are disabled.
21 Oct 2009, 10:15 AM
#41
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

how would I make the categories expand?

That's fantastic. Thanks for your help.

One last option would be great. That if you click on a catagory or subcatagory, that catagory or the catagory that the subcat belongs to if the only one showing in the catagories box with a single "view all catagories" link at the very top to bring someone back to show all catagories.

I hope I make sense. I take it that's not possible yet?

21 Oct 2009, 5:56 PM
#42
gjh42 avatar

gjh42

Black Belt

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

Re: how would I make the categories expand?

It couldn't be achieved with the current available settings alone.

Switching from a "top + first subs" view when no cats have been clicked to some variety of "active tree only" view when a cat is active could be done in categories_dressing_defines.php by adding another case with appropriate coding to the cat_active_level_manage() function.

Getting the "view all" button when a cat is active would be trickier, and I would have to think about the best way to do that.

21 Oct 2009, 6:04 PM
#43
gjh42 avatar

gjh42

Black Belt

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

Re: how would I make the categories expand?

This may do the control you want. I have not tested it; try it and let me know if there is a problem.```php
case 6://like 4, per level when none active
if($cPath_top == 0){
$test_level = 1;
break;
}
if($cPath_top == $path_top){
if ($cat_depth >= 2){//only test sub-subcats+
$path_ids = explode('',$path);
$path_parent = $path_ids[count($path_ids)-2];
if (!in_array($path_parent,explode('
',$_GET['cPath']))) $skip_cat = 1;//show only subcats w parent in $cPath
}
} else {//if not active test for level
$skip_cat = 1;
}
break;

21 Oct 2009, 6:51 PM
#44
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: how would I make the categories expand?

Thanks again. Where would I add this? I'm sure it's obvious but I know nothing about php.

Tim.

21 Oct 2009, 7:39 PM
#45
gjh42 avatar

gjh42

Black Belt

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

Re: how would I make the categories expand?

OK, edit /includes/functions/extra_functions/categories_dressing_functions.php, and add it after the "case 5" code block.```php
case 5:// show active, no top, per levels
if ($cat_depth == 0 or $cPath_top != $path_top) {
$skip_cat = 1;
}else{
$test_level = 1;
}
break;
case 6://like 4, per level when none active
if($cPath_top == 0){
$test_level = 1;
break;
}
if($cPath_top == $path_top){
if ($cat_depth >= 2){//only test sub-subcats+
$path_ids = explode('',$path);
$path_parent = $path_ids[count($path_ids)-2];
if (!in_array($path_parent,explode('
',$_GET['cPath']))) $skip_cat = 1;//show only subcats w parent in $cPath
}
} else {//if not active test for level
$skip_cat = 1;
}
break;
}//switch

Then edit the define with '6|0|1'.
22 Oct 2009, 10:46 AM
#46
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: how would I make the categories expand?

It works perfectly. Amazing, thank you!

22 Oct 2009, 2:15 PM
#48
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: how would I make the categories expand?

It's not a live site as you can see. There is still alot of work to be done and I have yet to change the colors in the menu. On that, is it possible to change the background color of a subcat only when it is active?

The right hand menu is also just temporary.

http://www.lowpricedhardware.ie/

22 Oct 2009, 3:11 PM
#49
gjh42 avatar

gjh42

Black Belt

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

Re: how would I make the categories expand?

You can highlight the current category path with these selectors (already in your stylesheet_chcategories_dressing.css):

#chcategories li a.cat-selected-text {}
#chcategories li a.cat-parent-text {}

22 Oct 2009, 3:41 PM
#50
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: how would I make the categories expand?

Thanks yet again.

I'm sure I'm missing something very obvious but how do I change the font, and background color of the main cat headings? And the backgund color of the subcats?

23 Oct 2009, 11:49 AM
#51
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: how would I make the categories expand?

I still havn't figured out how to change the font of just the top catagories.

looking at the code that is outputted,

<li class="cat-top"><a class="cat-not-selected-text" href="http://lowpricedhardware.ie/index.php?main_page=index&cPath=2374">CAMERAS</a>
<ul id="catGroup2374_2439">
  <li class="cat-subs"><a class="cat-not-selected-text" href="http://lowpricedhardware.ie/index.php?main_page=index&cPath=2374_2439">Accessories</a></li>
  <li class="cat-subs"><a class="cat-not-selected-text" href="http://lowpricedhardware.ie/index.php?main_page=index&cPath=2374_2446">Camera Lenses</a></li>

  <li class="cat-subs"><a class="cat-not-selected-text" href="http://lowpricedhardware.ie/index.php?main_page=index&cPath=2374_2375">Digital camera</a></li>
  <li class="cat-subs"><a class="cat-not-selected-text" href="http://lowpricedhardware.ie/index.php?main_page=index&cPath=2374_2461">Digital photo frame</a></li>
  <li class="cat-subs"><a class="cat-not-selected-text" href="http://lowpricedhardware.ie/index.php?main_page=index&cPath=2374_2597">Flash</a></li>
  <li class="cat-subs"><a class="cat-not-selected-text" href="http://lowpricedhardware.ie/index.php?main_page=index&cPath=2374_2523">Memory cards</a></li>

The first li doesn't seem to be closed?

<li class="cat-top"><a class="cat-not-selected-text" href="http://lowpricedhardware.ie/index.php?main_page=index&cPath=2374">CAMERAS</a>
<ul id="catGroup2374_2439">
  <li class="cat-subs">

so the sub cats get their style from the first

<li class="cat-top">

?

23 Oct 2009, 4:34 PM
#52
gjh42 avatar

gjh42

Black Belt

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

Re: how would I make the categories expand?

The first <li> in your snippet encloses the whole subcat list. This is a discussion better continued in the Categories Dressing support thread.

In general, you style outer or generic elements, and then style inner or more specific elements if you want them different.

29 Oct 2009, 12:02 PM
#53
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: how would I make the categories expand?

Ok thanks again for all your help. It's very appriciated.

14 Nov 2009, 1:52 PM
#54
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: how would I make the categories expand?

One thing I'm still trying to figure out is how to make a link at the top of the catagories that replaces the "catagories" text when on anything other than the main page that says something like "browse all catagories" or something like that.

5 Dec 2009, 10:10 PM
#56
timdwyer42 avatar

timdwyer42

Zen Follower

Join Date:
Apr 2009
Posts:
149
Plugin Contributions:
0

Re: how would I make the categories expand?

Thanks again. One final configuration would make things pretty much perfect, but is probably not possible.

But, would it be possible for say to have all the categories explanded to the first subcat level. But when anyone clicks on the link of a cat. or subcat, for that whole cat and subcat to move to the top of the cats/subcats......as if it's sort order was 1 and the rest were higher than that, until they click on a cat/subcat of one of the other cats, which would then move to the top..

6 Dec 2009, 6:20 PM
#57
gjh42 avatar

gjh42

Black Belt

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

Re: how would I make the categories expand?

I'm not sure that's a good idea, moving items around in the menu so the order is not consistent.

Since there is a class tag for the current category, it would be possible to use absolute and relative positioning on various elements and make a selected category move to the top of its parent's subcat list. That would probably require leaving a blank space at the top when no subcat has been selected, as you can't style an element based on conditions of a child element.