Using Expanded Category 2. I would like to just show category, and 1st subcategory.
I want all of the other subcategories to be hidden(collapsed).
Is there a way to do this?
Thanks.
Using Expanded Category 2. I would like to just show category, and 1st subcategory.
I want all of the other subcategories to be hidden(collapsed).
Is there a way to do this?
Thanks.
Very easy. The category depth is shown in $cPath, with subcats separated by underscores _ . If it has one underscore, it is a first level subcat, two underscores = second level, etc. You can access that information for each prospective category in the list with
substr_count($box_categories_array[$i]['path'],'_')
Find this in /includes/templates/your_template/sideboxes/tpl_categories.php:
and addPHP Code: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 {
substr_count($box_categories_array[$i]['path'],'_') > 1 or
to get
PHP Code:if (substr_count($box_categories_array[$i]['path'],'_') > 1 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 {
Thanks Glenn, your help is invaluable!
Hiya I not sure of someone still check here but I can not find this Expanded Category 2?
And I want the Category to always show the submenu (not the products)![]()
Please tell me where to get this addon!
The mod is called Expanded Category List (by Clydejones) and can be found in Downloads.
Thanks giving it a go but it say it also will list the products![]()
Never used it myself so can't comment... I have heard this complaint from other people, but I have also heard from people saying they use it and don't see products in their categories box.
At any rate, there is another mod called Uncollapsed Categories Tree by fragfutter (hosted on his own site) that reportedly works exactly as you want.
(It creates a sidebox id of ch_categories, so you can tell by viewing a site's source that they are using this mod.)
Glenn:
I added the code but it doesn't seem to make any difference in the display of the category sidebox. I think I'm missing something here. Isn't there some place in the code where I specify how many sub-levels to limit the display? It's probably obvious to experience programmers, but my skills at php are still quite limited.
My goal is to show only the top level categories and the first sub-level below the top. No products.
Here is the way I modified the code:
Thanks for any help.Code:// beg mod 2008-01-14 per forum http://www.zen-cart.com/forum/showthread.php?t=83405 post #2 author gjh42 to limit category list to 1 subcategory level. // 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)) { substr_count($box_categories_array[$i]['path'],'_') > 1 or 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)) { // end mod 2008-01-14
Ron
www.aspenshopsonline.com - ZenCart 1.3.9h
www.wilkssupply.com - ZenCart 1.3.9h
www.un-du.net - ZenCart 1.3.8a
gjh42 Glenn:
I caught the mistake in the previously quoted code. Had the "if" statements misplaced. Here is the correct code, but nevertheless, the problem still exists. I'm showing all category levels and products, but only want two levels.
RonCode:// beg mod 2008-01-14 per forum http://www.zen-cart.com/forum/showthread.php?t=83405 post #2 author gjh42 to limit category list to 1 subcategory level. // 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)) { if (substr_count($box_categories_array[$i]['path'],'_') > 1 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)) { // end mod 2008-01-14 // skip if this is for the document box (==3)
www.aspenshopsonline.com - ZenCart 1.3.9h
www.wilkssupply.com - ZenCart 1.3.9h
www.un-du.net - ZenCart 1.3.8a
The specification of sub-levels happens here:
substr_count($box_categories_array[$i]['path'],'_') > 1
In English, it counts the number of times that an _ appears in the string contained in $box_categories_array[$i]['path']. There will be one _ for each level of subcategory, so that's all the technology needed for the spec!
The whole if() statement skips the category in the list if any of the conditions is true (like the number of _ being > 1).
As to why it's not working for you, I'll have to check some more.