Does anyone have a website up at the moment with this mod? I would be good to see an example of what it can look like.
Printable View
Does anyone have a website up at the moment with this mod? I would be good to see an example of what it can look like.
limelites.co.uk is one with an extensive installation. There are also examples that are currently operational linked in posts 1141, 1138, 1130, and more if you look further back.
So you can categorize the categories... fantastic! Thanks for taking the time to show some examples... looks like it's what I'm looking for.
There are also demo screenshots in posts 500-510, showing more features the mod is capable of.
connected to my last post regarding cetegories in my left sidebox I am switching to this thread:wink:
@GlennCode:"This thread was very helpeful to me because I need same thing on my website and I achieved it thanks to Glenns code bellow
Code:
// subcat limit 2007-12-20
if (substr_count($box_categories_array[$i]['path'],'_') = 0 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 {
but in my case I dont need subcategories to show any further subcategories. To explain what I want to achieve here's the example:
-----------------------------------------------
THIS IS HOW IT LOOKS LIKE NOW:
-----------------------------------------------
MAZDA (1st subcategorie level)
- mx (2nd subcategorie level)
-- 2005 year (3rd subcategorie level)
-- 2006 year
-- 2007 year
- cx
- rx
MERCEDES
- c
- e
- s
MITSUBISHI
- lancer
- pajero
- l200
-----------------------------------------------
THIS IS HOW I NEED IT:
-----------------------------------------------
MAZDA (1st subcategorie level)
MERCEDES
MITSUBISHI
Any help is wellcome, thanks! "
Yes, I am using Categories Dressing add on. Now where do I start, using Cat.Dr., so I could acomplish to have only 1st level subcategorie visible and all other categ./subcat. hided.. I looked through folders of my zencart wesite (in includes/classes) and found "ch_categories_tree_generator" Is this a file I should edit?
No, that file generates the complete list, while the template file (and its functions) limits the display according to the settings.
What is your current setting for
define('CAT_BOX_ACTIVE_LEVEL', '#|#|#')
If you want different levels of (sub)categories to show in the different sideboxes, as I believe is your intention, it may require some special coding.
You have the standard categories sidebox at the top left, and the chcategories sidebox below it. Do you want both of them displayed?
thank you for promt reply Glenn, really appreciate it
no, its OK, for start I will use only one sidebox - ch_categories.php
I have disabled first sidebox at the top left (classic categories.php) few minutes ago, so I will use only one: ch_categories.php What is first step I should do with Categories Dressing so I could see only 1st level subcategorie visible and all other categ./subcat. hided?Quote:
You have the standard categories sidebox at the top left, and the chcategories sidebox below it. Do you want both of them displayed?
sorry I forgot to answer this one:blush:
code from file "categories_dressing_functions.php"
Code:function cat_active_level_manage($path) {
$skip_cat = 0;
if (defined('CAT_BOX_ACTIVE_LEVEL')) {
$test_level = 0;
$cat_box_active_level = explode('|',constant('CAT_BOX_ACTIVE_LEVEL'));
$cPath_top = (int)$_GET['cPath'];
$path_top = (int)$path;
$cat_depth = substr_count($path,'_');
//tests for various kinds of skipping - more can be added
switch ($cat_box_active_level[0]){
case 0:
$test_level = 1;
break;
case 1://active tree only
if($cPath_top != $path_top) $skip_cat = 1;
break;
case 2://active only (all tops when no cat selected)
if($cPath_top != $path_top and $cPath_top != 0) $skip_cat = 1;
break;
case 3://full active tree, others per level
if($cPath_top != $path_top) $test_level = 1;
break;
case 4://like 3, active branches only
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
$test_level = 1;
}
break;
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;
}//switch
if ($test_level){
switch ('true'){
case ($cat_box_active_level[1] > $cat_depth):
$skip_cat = 1;
break;
case ($cat_box_active_level[2] < $cat_depth):
$skip_cat = 1;
break;
}//switch
}//if
}//defined
return $skip_cat;
}
OK, that makes it easy.
You didn't mention your current setting for
define('CAT_BOX_ACTIVE_LEVEL', '#|#|#')
It should probably be
define('CAT_BOX_ACTIVE_LEVEL', '0|1|1')
The function code is not the setting, and yours shows that it is the standard version of the function.
OK, I changed code in categories_dressing_functions.php saved/upload it and it now it looks like this:
Quote:
function cat_active_level_manage($path) {
$skip_cat = 0;
if (defined('CAT_BOX_ACTIVE_LEVEL','0|1|1')) {
$test_level = 0;
$cat_box_active_level = explode('|',constant('CAT_BOX_ACTIVE_LEVEL'));
$cPath_top = (int)$_GET['cPath'];
$path_top = (int)$path;
$cat_depth = substr_count($path,'_');
//tests for various kinds of skipping - more can be added
switch ($cat_box_active_level[0]){
case 0:
$test_level = 1;
break;
case 1://active tree only
if($cPath_top != $path_top) $skip_cat = 1;
break;
case 2://active only (all tops when no cat selected)
if($cPath_top != $path_top and $cPath_top != 0) $skip_cat = 1;
break;
case 3://full active tree, others per level
if($cPath_top != $path_top) $test_level = 1;
break;
case 4://like 3, active branches only
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
$test_level = 1;
}
break;
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;
}//switch
if ($test_level){
switch ('true'){
case ($cat_box_active_level[1] > $cat_depth):
$skip_cat = 1;
break;
case ($cat_box_active_level[2] < $cat_depth):
$skip_cat = 1;
break;
}//switch
}//if
}//defined
return $skip_cat;
}
but no changes on left sidebox on website (you can check it out when you click on "Selling parts" in top menu bar)