[HACK] An Easy Way To Manage Your Side-Category List
Posted: Mon Sep 28, 2009 3:06 pm
Problem: The default way in which the Side-Category/Subcategory menu is presented can often make for some exceedingly long and unwieldy menu displays. ~ I needed a simple way to get this under control. Again... something SIMPLE that didn't require a lot of PHP or CSS or HTML or JavaScript modifications.
Analysis: After reviewing my list of categories and subcategories, I saw that it was not absolutely necessary to display many of the sub-categories in the Side-Category Menu. ~ However... those sub-categories ARE necessary to have because they help to organize the products and make things easier to find.
Goal: Find a way to trim-down the Side-Categories menu (by removing selected sub-categories)... but STILL have those sub-categories exist, so that customers can access them, and so that the products inside are neatly organized.
SOLUTION: The steps described below will allow you to "hide" sub-categories (ie: prevent them from being displayed in the Side-Categories menu) yet they are still visible and easily accessed from within the top-level category.
As always... MAKE BACKUPS, TEST BEFORE GOING LIVE, etc etc.
VERSION USED HERE: ISC 4.07
FILE TO EDIT: /includes/display/SideCategoryList.php
FIND: (near line 65)
INSERT ABOVE THAT LINE:
(The comments are optional... but if you need to make changes in the future, it will be easy to see-understand-remember the changes you made.)
Upload the file to your server and test to make sure your Side-Categories menu still displays properly. (Assuming that none of your current category names begin with a dash "-", then you should notice no changes.)
TO "HIDE" SUB-CATEGORIES:
From the Admin menu, select "Products" from the menu-tabs... then select "Product Categories" from the drop-down menu.
Next, find a sub-menu that you want to hide... click "Edit" on its row.
Rename the sub-menu item by adding a dash and a space just before it... save your changes.
TEST YOUR CHANGES:
-- Verify that the renamed sub-menu does not appear in the Side-Categories list.
-- Click the parent category of the newly hidden item... and the renamed sub-category should be displayed in the sub-category block at the top of the page.
NOTES: You can use any leading-character to flag the sub-categories that you want to hide. Just make the appropriate changes to your PHP code. (I chose to use a dash because it was fairly unobtrusive and wouldn't cause customers any confusion.)
POSSIBLE ISSUE: Here is one thing to watch out for (but that I have not tested because my sub-category levels are only one layer deep.
o What happens if the hidden sub-category ALSO has child sub-categories of its own?
o What happens if those sub-sub-categories are not renamed and hidden using this method?
o Will they be displayed anyway? If so, how will this affect the Side-Category structure?
Good Luck! ~ Post any improvements or corrections here.
Analysis: After reviewing my list of categories and subcategories, I saw that it was not absolutely necessary to display many of the sub-categories in the Side-Category Menu. ~ However... those sub-categories ARE necessary to have because they help to organize the products and make things easier to find.
Goal: Find a way to trim-down the Side-Categories menu (by removing selected sub-categories)... but STILL have those sub-categories exist, so that customers can access them, and so that the products inside are neatly organized.
SOLUTION: The steps described below will allow you to "hide" sub-categories (ie: prevent them from being displayed in the Side-Categories menu) yet they are still visible and easily accessed from within the top-level category.
As always... MAKE BACKUPS, TEST BEFORE GOING LIVE, etc etc.
VERSION USED HERE: ISC 4.07
FILE TO EDIT: /includes/display/SideCategoryList.php
FIND: (near line 65)
Code: Select all
$catName = isc_html_escape($subCat['catname']);
Code: Select all
// Check to see if the category name begins with a dash
// If so, skip it... and move on to the next item in the list.
if (substr($subCat['catname'], 0, 1) == "-") {continue;}
Upload the file to your server and test to make sure your Side-Categories menu still displays properly. (Assuming that none of your current category names begin with a dash "-", then you should notice no changes.)
TO "HIDE" SUB-CATEGORIES:
From the Admin menu, select "Products" from the menu-tabs... then select "Product Categories" from the drop-down menu.
Next, find a sub-menu that you want to hide... click "Edit" on its row.
Rename the sub-menu item by adding a dash and a space just before it... save your changes.
TEST YOUR CHANGES:
-- Verify that the renamed sub-menu does not appear in the Side-Categories list.
-- Click the parent category of the newly hidden item... and the renamed sub-category should be displayed in the sub-category block at the top of the page.
NOTES: You can use any leading-character to flag the sub-categories that you want to hide. Just make the appropriate changes to your PHP code. (I chose to use a dash because it was fairly unobtrusive and wouldn't cause customers any confusion.)
POSSIBLE ISSUE: Here is one thing to watch out for (but that I have not tested because my sub-category levels are only one layer deep.
o What happens if the hidden sub-category ALSO has child sub-categories of its own?
o What happens if those sub-sub-categories are not renamed and hidden using this method?
o Will they be displayed anyway? If so, how will this affect the Side-Category structure?
Good Luck! ~ Post any improvements or corrections here.