EricB Posted July 13, 2004 Share Posted July 13, 2004 This took me forever to figure out, but I finally did it :D I know some others out there wanted to get rid of the subcategories, but there didn't seem to be anyone able to tell us how to do it. Now hopefully, this will help you: In the includes>boxes>categories.php file at around line 93 (if you haven't changed anything, anyway) you should see the following lines: //------------------------ if (tep_not_null($cPath)) { $new_path = ''; reset($cPath_array); while (list($key, $value) = each($cPath_array)) { unset($parent_id); unset($first_id); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query)) { $new_path .= $value; and so on. Change the //---------------------- to /*----------This section prints the subcategories. Comment out to keep them hidden------------------ Now, go down to } tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); and change to } */ tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); Now just save and upload! Hope this helps! Link to comment Share on other sites More sharing options...
TAPAKAH Posted July 28, 2004 Share Posted July 28, 2004 THANKS A LOT!!! works great! Link to comment Share on other sites More sharing options...
Guest Posted August 4, 2004 Share Posted August 4, 2004 When I first saw this thread, I couldn't imagine why I would want to hide sub-categories. However, I just implemented coolMenu and was trying to come up with the best way to make the categories menu functional for users who have JS disabled. I came up with the idea of 'hiding' the regular menu underneath coolMenu but obviously it was a mess when the sub-cats popped into view. Anyway --- by disabling the display of sub-cats, coolMenu now stays perfectly positioned and everything displays perfectly (sans sub-cats) with JS off as well. Thanks for the tip m8. :) Link to comment Share on other sites More sharing options...
h4ppy_girl Posted September 1, 2004 Share Posted September 1, 2004 I tried doing this and have this error: Warning: Unterminated comment starting line 92 in /home/virtual/site23/fst/var/www/html/oscommerce/includes/boxes/shopping_cart.php on line 92 Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/virtual/site23/fst/var/www/html/oscommerce/includes/boxes/categories.php:13) in /home/virtual/site23/fst/var/www/html/oscommerce/includes/boxes/shopping_cart.php on line 13 Can you tell me the problem. Here is the code: <?php /* $Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } $categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } } ?> <!-- categories //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); new infoBoxHeading($info_box_contents, true, false); $categories_string = ''; $tree = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $tree[$categories['categories_id']] = array('name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $categories['categories_id']; } $parent_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } } /*------------------------ if (tep_not_null($cPath)) { $new_path = ''; reset($cPath_array); while (list($key, $value) = each($cPath_array)) { unset($parent_id); unset($first_id); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query)) { $new_path .= $value; while ($row = tep_db_fetch_array($categories_query)) { $tree[$row['categories_id']] = array('name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $row['categories_id']; } $parent_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } $tree[$last_id]['next_id'] = $tree[$value]['next_id']; $tree[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } */ tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); ?> </td> </tr> <!-- categories_eof //--> "Look closely at the present you are constructing. It should look like the future you dream of." -Alice Walker Link to comment Share on other sites More sharing options...
crash3903 Posted September 1, 2004 Share Posted September 1, 2004 you have a blank line at the top of the page delete the blank line and that should resolve it :-) Alos make sure you have no blank lines at the bottom ;-) regads mark Regards Mark A Reynolds Link to comment Share on other sites More sharing options...
Berberer Posted September 1, 2004 Share Posted September 1, 2004 do you have a page where i can see what it will look like?? thanks ! Link to comment Share on other sites More sharing options...
Druide Posted September 2, 2004 Share Posted September 2, 2004 I tried doing this and have this error: Warning: Unterminated comment starting line 92 in /home/virtual/site23/fst/var/www/html/oscommerce/includes/boxes/shopping_cart.php on line 92 Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/virtual/site23/fst/var/www/html/oscommerce/includes/boxes/categories.php:13) in /home/virtual/site23/fst/var/www/html/oscommerce/includes/boxes/shopping_cart.php on line 13 Can you tell me the problem. Here is the code: <?php /* $Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } $categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } } ?> <!-- categories //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); new infoBoxHeading($info_box_contents, true, false); $categories_string = ''; $tree = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $tree[$categories['categories_id']] = array('name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $categories['categories_id']; } $parent_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } } /*------------------------ if (tep_not_null($cPath)) { $new_path = ''; reset($cPath_array); while (list($key, $value) = each($cPath_array)) { unset($parent_id); unset($first_id); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query)) { $new_path .= $value; while ($row = tep_db_fetch_array($categories_query)) { $tree[$row['categories_id']] = array('name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false); if (isset($parent_id)) { $tree[$parent_id]['next_id'] = $row['categories_id']; } $parent_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } $tree[$last_id]['next_id'] = $tree[$value]['next_id']; $tree[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } */ tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); ?> </td> </tr> <!-- categories_eof //--> guys&gals can you read error messages ??? tep_show_category() (previously declared in /home/virtual/site23/fst/var/www/html/oscommerce/includes/boxes/categories.php:13 that means that function tep_show_category() already exists & is allready defined in includes/boxes/categories.php line 13 !!! Robert We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;) Link to comment Share on other sites More sharing options...
h4ppy_girl Posted September 2, 2004 Share Posted September 2, 2004 Thanks for help. I had actually changed something in the shoppin_cart that messed things up. Back on track! "Look closely at the present you are constructing. It should look like the future you dream of." -Alice Walker Link to comment Share on other sites More sharing options...
osjunkie Posted November 26, 2004 Share Posted November 26, 2004 I did this and my coolmenu still shows the sub categories. What am I missing? Link to comment Share on other sites More sharing options...
rcr121 Posted June 15, 2005 Share Posted June 15, 2005 Can anyone tell me how to do this, so that ONLY the subcategories show? I don't want the top level to appear in my categories box, and I can't figure out how to supress it!! Thanks in advance, RCR Link to comment Share on other sites More sharing options...
FrancineNJ Posted July 22, 2005 Share Posted July 22, 2005 I orginally posted this in General Support...and received no answer. When I came across this thread actually talking about categories.php.....I thought I'd try it here. Before my site went live...I moved everything up at of the "catalog" directory to the root. I then started having a problem with my categories.php. Besides products that are added thru the admin to the site (videos etc), at the bottom I had links to books, music, poster pages. Those links were pointing to catalog/comedy_books.php. So, I downloaded the file...categories.php and found that these links had catalog/comedy_books.php in the link. I then removed all mention of catalog in their links and re-uploaded it. I then created a separate box for the books and this is working fine. Only thing is.....after editing the categories.php file and deleting all the links for the books, music, and posters. They still show up as though I never edited the file. And now I have two boxes showing books. Also, when you first go over you don't see the books, music, posters in the first box. However if you click on the books link in the second box...the second page shows my problem....the first box with books, music, posters in it. UGH!!!!!! >_< Can someone tell me what do I need to do, to not have the books, music and poster in the categories box not show without doing away with that entire box. Thank you, You can see this problem at: SimplyPink - it is a live site. Link to comment Share on other sites More sharing options...
oscommerceking Posted August 4, 2005 Share Posted August 4, 2005 I orginally posted this in General Support...and received no answer. When I came across this thread actually talking about categories.php.....I thought I'd try it here. Before my site went live...I moved everything up at of the "catalog" directory to the root. I then started having a problem with my categories.php. Besides products that are added thru the admin to the site (videos etc), at the bottom I had links to books, music, poster pages. Those links were pointing to catalog/comedy_books.php. So, I downloaded the file...categories.php and found that these links had catalog/comedy_books.php in the link. I then removed all mention of catalog in their links and re-uploaded it. I then created a separate box for the books and this is working fine. Only thing is.....after editing the categories.php file and deleting all the links for the books, music, and posters. They still show up as though I never edited the file. And now I have two boxes showing books. Also, when you first go over you don't see the books, music, posters in the first box. However if you click on the books link in the second box...the second page shows my problem....the first box with books, music, posters in it. UGH!!!!!! >_< Can someone tell me what do I need to do, to not have the books, music and poster in the categories box not show without doing away with that entire box. Thank you, You can see this problem at: SimplyPink - it is a live site. <{POST_SNAPBACK}> Anyone know how to eliminate subcategories in the advanced search drop down list?????????? PPPPPPPPPPPLease help im desperate Jon My Contributions: Add Search + Drop Down Anywhere, Eliminate Subcategories in Drop Down Link to comment Share on other sites More sharing options...
Guest Posted August 4, 2005 Share Posted August 4, 2005 Go to advanced_search.php and find: <tr> <td class="fieldKey"><?php echo ENTRY_CATEGORIES; ?></td> <td class="fieldValue"><?php echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))); ?> </td> </tr> comment it out or delete it. This will get rid of categories on advanced search page. Link to comment Share on other sites More sharing options...
oscommerceking Posted August 5, 2005 Share Posted August 5, 2005 Go to advanced_search.php and find: <tr> ? ?<td class="fieldKey"><?php echo ENTRY_CATEGORIES; ?></td> ? ?<td class="fieldValue"><?php echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))); ?> ? ?</td> </tr> comment it out or delete it. This will get rid of categories on advanced search page. <{POST_SNAPBACK}> Will this hide only subcategories, i want to make categories still visible , just hide the subs Thanks for the quick response Jon My Contributions: Add Search + Drop Down Anywhere, Eliminate Subcategories in Drop Down Link to comment Share on other sites More sharing options...
oscommerceking Posted August 6, 2005 Share Posted August 6, 2005 Will this hide only subcategories, i want to make categories still visible , just hide the subs Thanks for the quick response Jon <{POST_SNAPBACK}> To anyone with the same question: Click here for contribution + solution Cheers Jon My Contributions: Add Search + Drop Down Anywhere, Eliminate Subcategories in Drop Down Link to comment Share on other sites More sharing options...
thomasking Posted August 16, 2005 Share Posted August 16, 2005 I know this is a little unrelated to the exact topic, but somehow similar... tried searching for similar topic and couldnt find it... What I would like to do is remove the standard -> extension after a category that has sub cats, but instead have a plus or minus box icon before it, like windows explorer. I am sure there is a contrib for this, just cant find it. Link to comment Share on other sites More sharing options...
abayyari Posted September 12, 2005 Share Posted September 12, 2005 I know this is a little unrelated to the exact topic, but somehow similar... tried searching for similar topic and couldnt find it... What I would like to do is remove the standard -> extension after a category that has sub cats, but instead have a plus or minus box icon before it, like windows explorer. I am sure there is a contrib for this, just cant find it. <{POST_SNAPBACK}> Look for this code block in categories.php if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } Change the '->' to a plus sign '+'. You can more the entire piece of code upwards in the file if you want the plus sign to be displayed before the category name. Hope that helps. Cheers! Ahmed Link to comment Share on other sites More sharing options...
Guest Posted September 25, 2005 Share Posted September 25, 2005 somewhat of a similar problem i'm having: i want the subcategories to have a different color/style from the regular category links, how can i achieve this? this i what i want: regular category1 - nested category1 - nested category2 regular category2 regular category3 Link to comment Share on other sites More sharing options...
Guest Posted September 27, 2005 Share Posted September 27, 2005 anyone know? Link to comment Share on other sites More sharing options...
rhodgkiss2001 Posted January 13, 2006 Share Posted January 13, 2006 This took me forever to figure out, but I finally did it :D I know some others out there wanted to get rid of the subcategories, but there didn't seem to be anyone able to tell us how to do it. Now hopefully, this will help you: In the includes>boxes>categories.php file at around line 93 (if you haven't changed anything, anyway) you should see the following lines: ?//------------------------ ?if (tep_not_null($cPath)) { ? ?$new_path = ''; ? ?reset($cPath_array); ? ?while (list($key, $value) = each($cPath_array)) { ? ? ?unset($parent_id); ? ? ?unset($first_id); ? ? ?$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); ? ? ?if (tep_db_num_rows($categories_query)) { ? ? ? ?$new_path .= $value; and so on. Change the //---------------------- to /*----------This section prints the subcategories. Comment out to keep them hidden------------------ Now, go down to ?} ?tep_show_category($first_element); ?$info_box_contents = array(); ?$info_box_contents[] = array('text' => $categories_string); ?new infoBox($info_box_contents); and change to ?} ?*/ ?tep_show_category($first_element); ?$info_box_contents = array(); ?$info_box_contents[] = array('text' => $categories_string); ?new infoBox($info_box_contents); Now just save and upload! Hope this helps! Link to comment Share on other sites More sharing options...
kwalker Posted January 14, 2006 Share Posted January 14, 2006 Look for this code block in categories.php if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } Change the '->' to a plus sign '+'. You can more the entire piece of code upwards in the file if you want the plus sign to be displayed before the category name. Hope that helps. Cheers! Ahmed Cool, I like that! Kevin "What I didn't know yesterday, I know today & will remember tomorrow" (By Kwalker) What do you see when you open up the tep_database-pr2.2-CVS.pdf file that came with your osCommerce download? Link to comment Share on other sites More sharing options...
ely2c Posted March 7, 2006 Share Posted March 7, 2006 This is sort of relevant. I have a website with top level categories, subcategories and the products under the subcategories. On the homepage I only want to show the Top level Categories, however when I click on a Category I only want to see the subcategory of that Category. Does this make sense? Appreciate anyones help. This will really make navigation a lot easier for the user. Thanks in advance. Link to comment Share on other sites More sharing options...
amx_dk Posted April 9, 2006 Share Posted April 9, 2006 This is sort of relevant. I have a website with top level categories, subcategories and the products under the subcategories. On the homepage I only want to show the Top level Categories, however when I click on a Category I only want to see the subcategory of that Category. Does this make sense? Appreciate anyones help. This will really make navigation a lot easier for the user. Thanks in advance. Did you figure this out? I want the same thing. (I think) I want my categories to show like this. top categories (show items if any) sub categories (show all items in sub categories) is this possible in any way? I have been trying to figure this out for ages. :( Link to comment Share on other sites More sharing options...
PJ2006 Posted May 3, 2008 Share Posted May 3, 2008 To anyone with the same question:Click here for contribution + solution Cheers Jon I want a search box that only lists the sub-categories for the selected category - is that an option? Link to comment Share on other sites More sharing options...
WizUnder Posted May 3, 2008 Share Posted May 3, 2008 This took me forever to figure out, but I finally did it :D I know some others out there wanted to get rid of the subcategories, but there didn't seem to be anyone able to tell us how to do it. Now hopefully, this will help you: In the includes>boxes>categories.php file at around line 93 (if you haven't changed anything, anyway) you should see the following lines: //------------------------ if (tep_not_null($cPath)) { $new_path = ''; reset($cPath_array); while (list($key, $value) = each($cPath_array)) { unset($parent_id); unset($first_id); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query)) { $new_path .= $value; and so on. Change the //---------------------- to /*----------This section prints the subcategories. Comment out to keep them hidden------------------ Now, go down to } tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); and change to } */ tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); Now just save and upload! Hope this helps! :D Thank you very much. I have been working on this all morning today. Eventually, everything is just coming out the way I want it to be. I added a css menu to make the categories more appealing. Here is my test site http://netcheaperdeals.com/ the colors the not final yet, but it is pretty much close to its final appearance, once I uploaded the big header graphics and some table refinements. Thanks again for your contribution...This is the only way you can avoid the subcategories going out of control within the CSS menu.. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.