Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Limit subcategory display in sidebox to one level only

Limit subcategory display in sidebox to one level only

Locked

Views: 2,366

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
01 Oct 2007, 00:44
#1
kusogaki avatar

kusogaki

New Zenner

Join Date:
Feb 2006
Location:
San Diego, CA
Posts:
28
Plugin Contributions:
0

Limit subcategory display in sidebox to one level only

Hopefully this is a simple fix that I am just overlooking. As the subject states, I want to limit how deep the subcategory listing goes to just one level. Reason being is that each subcategory (level 1) has at least 20-30 categories after it and that would just make the sidebox look a bit crazy. If it was less, that would be a different story.

I read on a previous post that someone just suggested breaking it up a bit more...which would work, but basically I am dealing with a comic book store with a long list of titles so there is still some necessity for a subcategory with many many categories below it.

An example of what I am trying to do:

-current-
Manga
-English
-multiple categories for each series or for a single alphabetical letter
-Japanese
-multiple categories for each series or for a single alphabetical letter

-what i'm trying to accomplish-
Manga
-English
-Japanese

One solution I've thought of was to just turn off subcategories listing under layout settings, but I still prefer to have at least the first level listed. If this can't be done, then I guess I can live with that, but hopefully someone knows what I should edit to get the ideal setting right. :)

01 Oct 2007, 00:56
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Limit subcategory display in sidebox to one level only

So how do you propose navigating to the sub-subcats? By picking from a list/grid in the center column? Only the currently active set of subcats will be shown (in either location), and I personally would appreciate being able to just go down an alphabetical list (even 30 items long) instead of having to scan a grid spread over a large area of the center.

What you have is actually

-current-
Manga
-English
-multiple categories for each series or for a single alphabetical letter
-Japanese

or
-current-
Manga
-English
-Japanese
-multiple categories for each series or for a single alphabetical letter

If you really think your customers will be happier not having this feature, there is a relatively simple mod I can work up for tpl_categories.php that will do this.

01 Oct 2007, 01:04
#3
kusogaki avatar

kusogaki

New Zenner

Join Date:
Feb 2006
Location:
San Diego, CA
Posts:
28
Plugin Contributions:
0

Re: Limit subcategory display in sidebox to one level only

Yeah, it was my intention to use the center as the way to navigate the level 2 subcategories. I've seen it used on Japanese comic store sites in a manner that was still very readable. Granted, what they had setup on the center is something that would require me to do a bit of modding to emulate. First step first though, right? :)

If there is a simple way of achieving what I am trying to do, I am more than grateful to accept any help you are willing to offer. Muchly appreciated. :)

Chris

01 Oct 2007, 02:53
#4
gjh42 avatar

gjh42

Black Belt

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

Re: Limit subcategory display in sidebox to one level only

In /includes/templates/your_template/sideboxes/tpl_categories.php, find around line 31```php
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 {

  
ereg("_.*_", $box_categories_array[$i]['path']) or 

to get```php
  
     if (ereg("_.*_", $box_categories_array[$i]['path']) or 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 {

This skips the item display if there are two or more _ in the cPath.

05 Oct 2007, 16:40
#5
glv avatar

glv

New Zenner

Join Date:
Oct 2007
Posts:
29
Plugin Contributions:
0

Re: Limit subcategory display in sidebox to one level only

I have a question very similar to this...

Is there an easy way to make it so all categories with subcategories are always expanded?

Only 2 of my categories have subcategories, and each one only has 2 subcategories, and our list is rather short, and I would prefer to be able to save our customers the extra click.

19 Feb 2008, 22:04
#7
member avatar

member

Zen Follower

Join Date:
Dec 2004
Posts:
102
Plugin Contributions:
0

Re: Limit subcategory display in sidebox to one level only

gjh42:

In /includes/templates/your_template/sideboxes/tpl_categories.php, find around line 31```php
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 {

>   
> ereg("_.*_", $box_categories_array[$i]['path']) or 
> 
> to get```php
  
     if (ereg("_.*_", $box_categories_array[$i]['path']) or 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 {

This skips the item display if there are two or more _ in the cPath.

Thanks, That works great for me! I am using the documents sidebox to hold a secondary part of my categories. This page explains more of what I am up to. You were helping me there too!

http://www.zen-cart.com/forum/showthread.php?t=88900

I used these instructions: http://www.zen-cart.com/forum/showthread.php?t=44445&highlight=two+category+boxes

What can I do to cause the documents sidebox to only show categories and subcategories, put no products when opened up (just like it works on the category box in the example you gave above)?

I would guess that I need to put something similar in tpl_document_categories.php from bettercategories

or maybe in tpl_document_general_info_display.php

I am just guessing. Thanks for any help you can offer.