Guest Posted January 26, 2007 Share Posted January 26, 2007 GREAT CONTRIB :D:D Apparently I am a CSS Idiot, even though I have done an OK job of adding 53 other contributions to my osC store, coding all the MySQL and PHP myself :| What I'm trying to do is get static "titles" in my menu, so I would have a nice bar that says something like "Tools" that is not clickable, and below it would be a separator and then my Tools categories. Then, below that, a second title something like "Tractors" and the tractor-related categories below that. There's a sample posted earlier in this thread that looks like it might be what I'm trying to do, but I'll be darned if, after three days of searching and coding, I can get something like that to work!!!!! Can someone smarter than me please post a suggestion or some sample code? I would really, really appreciate it, and my forehead would appreciate not having to bounce off my keyboard every five minutes out of frustration! Quote Link to comment Share on other sites More sharing options...
Guest Posted January 26, 2007 Share Posted January 26, 2007 Oh, and I have installed this contribution and I have tried playing around with the samples of CSS and what/not, but it hasn't made me any smarter :( Quote Link to comment Share on other sites More sharing options...
MauiJim Posted February 15, 2007 Share Posted February 15, 2007 Is it possible to display only the subcategories without the top categories?? What do i have to change?? Quote Link to comment Share on other sites More sharing options...
homewetbar Posted April 12, 2007 Share Posted April 12, 2007 (edited) I've been pulling my hair out for over two hours here trying to format this. It looks perfect in MSIE but the lines stick out extra far on the hover in FireFox. Here is the code, you can plug it directly into your stylesheet.css to see what I mean: #nav, #nav ul { /* all lists */ padding: 0; margin: 0; list-style: none; float : left; font-family: arial; font-size: 11px; background-color : white; } #nav li { /* all list items */ position : relative; float : left; line-height : 1.75em; width: 11.9em; background-color : white; } #nav li ul { /* second-level lists */ position : absolute; left: -999em; margin-left : 11.95em; margin-top : -2em; border: 1px solid black; margin-bottom : -1px; background-color : white; } #nav li ul ul { /* third-and-above-level lists */ left: -999em; margin-bottom : -1px; } #nav li a { /* Menu Boxes */ width: 11.8em; w\idth : 11.8em; display : block; color : 595959; text-decoration : none; padding: 1px 3px; border-bottom: 1px solid #d9d9da; } #nav li a:hover { color : white; background-color : black; width: 11.9em; } #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul { left: -999em; } #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul { /* lists nested under hovered list items */ left: auto; } Any ideas on what I could be doing wrong???? Edited April 12, 2007 by homewetbar Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
Guest Posted May 14, 2007 Share Posted May 14, 2007 Excellent contrib! The search engines LOVE it! Quote Link to comment Share on other sites More sharing options...
Guest Posted June 14, 2007 Share Posted June 14, 2007 Here's more...I have 22 main categories in total and three levels at maximum... Firefox: The webpage in Swedish shows the first four main categories and all four fly-out! The webpage in English shows the first three main categories and all three fly-out! IE: The webpage in Swedish shows the first four main categories and none of them fly-out! The webpage in English shows the first three main categories and none of them fly-out! We have to fix this to be able to use this contrib, of course...I'm not sure how. Here is the ie hover fix/hack: http://www.htmldog.com/articles/suckerfish/hover/ Quote Link to comment Share on other sites More sharing options...
Guest Posted June 14, 2007 Share Posted June 14, 2007 Thanks for this great contribution, this is exactly what I want! The other dynamic category enhancement I have run into I never got right...I have had a look at Suckerfish and this contributions looks very promising! If I have gotten the instructions right, doing a clean "to-start-with" install of this contribution is just a matter of putting ul_categories.php in the boxes directory and adding the example css to the stylesheet. I run into trouble though, because the menu only shows the first four main categories and no sub levels fly out... Running it without stylesheet renders an unorderd list (as promised) with the four first main categories and all their sub levels. Hmm. Have I missed something? if you are testing in internet explorer it isn't going to work without the iehover fix/hack http://www.htmldog.com/articles/suckerfish/hover/ you need it for vertical and horizontal flyouts in iexplorer ;) Quote Link to comment Share on other sites More sharing options...
Guest Posted June 14, 2007 Share Posted June 14, 2007 WHAT IS IT?This contribution is an alternate category box which will output your store's categories as a proper nested unordered list, instead of a collection of non-breaking spaces, quasi-bullets and break tags. What's the big deal about that you ask? With the categories now output as an unordered list, you can now more easily apply a lot of nifty CSS to turn your category list into a horizontal drop-down or vertical fly-out menu, make it a collapsible menu, easily attach bullets, add cool mouseover effects, or just about anything you can dream up! The advantage of this technique over pure javascript solutions is that it is much more flexible, easier to apply CSS trickery to, is more search-engine friendly and makes just one query to the database. Output includes optional CSS class tags to mark categories as selected or as parent cats. You can also choose to render all of your categories (useful for dynamic menus) or to render only the root cats and the selected category tree. Note that this contribution merely provides a foundation for you to construct a more attractive/functional menu by providing a more semantically-correct output. A little CSS-magic is required on your end, though I have included a sample vertical flyout menu CSS. I have included some resources in the readme. The download is available in the Contributions: http://www.oscommerce.com/community/contributions,4201 Any feedback, bug reports are welcome, or if you just want to post some cool unordered list menu resources or show off what you've done below... Hey thanks for the great contribution, it was exactly what I wanted. I have had no problems what so ever using it. I think the majority of problems are stemming from the lack of correctly styled css and lack of the ie hover fix. Thanks, Stephanie :thumbsup: Quote Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2007 Share Posted July 13, 2007 Hi Im having a problem applying the css. I have used the examples supplied but they dont make any difference to the menu. Is there a specific place in the style sheet i should place the code? Any help would be much appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted July 14, 2007 Share Posted July 14, 2007 Does anyone know how to display two of these menus at the same time? I tried creating two files and renaming queries, variables, ids & classes. But that didn't seem to work. Help is appreciated :D Stephanie Quote Link to comment Share on other sites More sharing options...
motorcity Posted February 19, 2008 Share Posted February 19, 2008 I'm attempting a little modification on this script and hoping someone can help me out, hey this could be fun! In the following pic I'm comparing the resulting column_left or includes/boxes/categories.php of 'Category Box as Nested Unordered List for EZ(er) CSS & Dynamic menus v 1.00 and contribution "Category Box Enhancement", version 1.1 If you noticed, we're 4 levels deep (it's obvious on the ul list left side). With a catalog this big (yeah, 'hardware' has over 14000 items), I'm using a horizontal coolmenu generated with the help of ul_cats as the main navigation, but hoping to keep using the column_left to aid customers as well. What I'm trying to do is basically 3 things; 1. I hope there is a way that I can control the amount of tab or space used in ul_cats (left side of pic) I believe that is being set by virtue of the li/ul stuff, any ideas? 2. I would like to have the Bold print markers of where the customer is in the catalog. Like you see in 'enhanced' on the right. 3. And most importantly I'm trying to get the red colored current location. ERRORTEXT - like in 'enhanced'. On to the fun part, here's what I believe is the relevant code from the right side (Category Box enhancement) global $tree, $categories_string, $cPath_array, $cat_name; for ($i=0; $i<$tree[$counter]['level']; $i++) { $categories_string .= " "; } $cPath_new = 'cPath=' . $tree[$counter]['path']; if (isset($cPath_array) && in_array($counter, $cPath_array) && $cat_name == $tree[$counter]['name']) { $categories_string .= '<a href="'; $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; } else { $categories_string .= '<a href="'; $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; } if (tep_has_category_subcategories($counter)) { $categories_string .= tep_image(DIR_WS_IMAGES . 'pointer_blue.gif', ''); } else { $categories_string .= tep_image(DIR_WS_IMAGES . 'pointer_blue_light.gif', ''); } if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } if ($cat_name == $tree[$counter]['name']) { $categories_string .= '<span class="errorText">'; } // display category name $categories_string .= $tree[$counter]['name']; if ($cat_name == $tree[$counter]['name']) { $categories_string .= '</span>'; } if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } And here is the general area I'm thinking (and lord knows I'm trying) to insert parts of the above code into from ul_categories; // Global Variables $GLOBALS['this_level'] = 0; // Initialize HTML and info_box class if displaying inside a box if ($show_ulcats_as_box) { echo '<tr><td>'; $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); new infoBoxHeading($info_box_contents, true, false); } // Generate a bulleted list (uses configuration options above) $categories_string = tep_make_cat_ullist(); // Output list inside a box if specified, otherwise just output unordered list if ($show_ulcats_as_box) { $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); echo '</td></tr>'; } else { echo $before_nobox_html; echo $categories_string; echo $after_nobox_html; } Once in a while I get lucky, at this point I'm hoping someone might increase my chances by giving me some pointers. Thanks in advance for any help you can offer. Quote Link to comment Share on other sites More sharing options...
motorcity Posted February 20, 2008 Share Posted February 20, 2008 I think this is getting closer. This is supposed to make opened categories bold and current location "red" = errortext. It doesn't cause any errors so I figure something isn't named correctly. I tried renaming $cat_name to $key - still no errors. It's ignoring my mod! This is ul_categories.php starting at line 156. $GLOBALS['this_level'] = $level; } if (isset($cPath_array) && in_array($key, $cPath_array) && $classname_for_selected) { $this_cat_class = ' class="'.$classname_for_selected.'"'; } else { $this_cat_class = ''; } $output .= '<li'.$this_cat_class.'><a href="'; if (!$level) { unset($GLOBALS['cPath_set']); $GLOBALS['cPath_set'][0] = $key; $cPath_new = 'cPath=' . $key; } else { $GLOBALS['cPath_set'][$level] = $key; $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1))); } if (tep_has_category_subcategories($key) && $classname_for_parent) { $this_parent_class = ' class="'.$classname_for_parent.'"'; } else { $this_parent_class = ''; } // start my mod from ~enhanced_categories lines 40-53~ if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } if ($cat_name == $tree[$counter]['name']) { $categories_string .= '<span class="errorText">'; } $categories_string .= $tree[$counter]['name']; if ($cat_name == $tree[$counter]['name']) { $categories_string .= '</span>'; } //end my mod $output .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '"'.$this_parent_class.'>'.$val; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($key); if ($products_in_category > 0) { $output .= ' (' . $products_in_category . ')'; } } $output .= '</a>'; if (!tep_has_category_subcategories($key)) { $output .= '</li>'."\n"; } if ((isset($table[$key])) AND (($maxlevel > $level + 1) OR ($maxlevel == '0'))) { $output .= tep_make_cat_ulbranch($key,$table,$level + 1,$maxlevel); } } // End while loop return $output; } ?> Quote Link to comment Share on other sites More sharing options...
altenter Posted March 25, 2008 Share Posted March 25, 2008 Looks like a very usefull contribution! How can I apply this code to articles box? Thanks. Quote Link to comment Share on other sites More sharing options...
janice171 Posted March 31, 2008 Share Posted March 31, 2008 Hi, I have a problem with closing </li> tags. It seems that if a category has a subcategory there is no closing </li> tag. I'm baffled as to why this is happening. Anyone know which part of the code is affecting this? Thanks for any help. Quote Link to comment Share on other sites More sharing options...
cottonmiller Posted July 22, 2008 Share Posted July 22, 2008 <?php /* $Id: ul_categories.php,v 1.00 2006/04/30 01:13:58 nate_02631 Exp $ Outputs the store category list as a proper unordered list, opening up possibilities to use CSS to style as drop-down/flyout, collapsable or other menu types. osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2006 Nate Welch [url="http://www.natewelch.com"]http://www.natewelch.com[/url] Released under the GNU General Public License */ // BEGIN Configuration options // Set to false to display the unordered list only. Set to true to display in // a regular box. The former is useful for better integrating the menu with your layout. $show_ulcats_as_box = false; // Indicates whether or not to render your entire category list or just the root categories // and the currently selected submenu tree. Rendering the full list is useful for dynamic menu // generation where you want the user to have instant access to all categories. The other option // is the default oSC behaviour, when the subcats aren't available until the parent is clicked. $show_full_tree = false; // This is the CSS *ID* you want to assign to the UL (unordered list) containing // your category menu. Used in conjuction with the CSS list you create for the menu. // This value cannot be blank. $idname_for_menu = 'categories'; // This is the *CLASSNAME* you want to tag a LI to indicate the selected category. // The currently selected category (and its parents, if any) will be tagged with // this class. Modify your stylesheet as appropriate. Leave blank or set to false to not assign a class. $classname_for_selected = 'selected'; // This is the *CLASSNAME* you want to tag a LI to indicate a category has subcategores. // Modify your stylesheet to draw an indicator to show the users that subcategories are // available. Leave blank or set to false to not assign a class. $classname_for_parent = 'parent'; // This is the HTML that you would like to appear before your categories menu if *not* // displaying in a standard "box". This is useful for reconciling tables or clearing // floats, depending on your layout needs. $before_nobox_html = '<div id="category_depts">'; // This is the HTML that you would like to appear after your categories menu if *not* // displaying in a standard "box". This is useful for reconciling tables or clearing // floats, depending on your layout needs. $after_nobox_html = '</div>'; // END Configuration options // Global Variables $GLOBALS['this_level'] = 0; // Initialize HTML and info_box class if displaying inside a box if ($show_ulcats_as_box) { echo '<tr><td>'; $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); new infoBoxHeading($info_box_contents, true, false); } // Generate a bulleted list (uses configuration options above) $categories_string = tep_make_cat_ullist(); // Output list inside a box if specified, otherwise just output unordered list if ($show_ulcats_as_box) { $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); echo '</td></tr>'; } else { echo $before_nobox_html; echo $categories_string; echo $after_nobox_html; } // Create the root unordered list function tep_make_cat_ullist($rootcatid = 0, $maxlevel = 0){ global $idname_for_menu, $cPath_array, $show_full_tree, $languages_id; // Modify category query if not fetching all categories (limit to root cats and selected subcat tree) if (!$show_full_tree) { $parent_query = 'AND (c.parent_id = "0"'; if (isset($cPath_array)) { $cPath_array_temp = $cPath_array; foreach($cPath_array_temp AS $key => $value) { $parent_query .= ' OR c.parent_id = "'.$value.'"'; } unset($cPath_array_temp); } $parent_query .= ')'; } else { $parent_query = ''; } $result = tep_db_query('select c.categories_id, cd.categories_name, c.parent_id from ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd where c.categories_id = cd.categories_id and cd.language_id="' . (int)$languages_id .'" '.$parent_query.' order by sort_order, cd.categories_name'); while ($row = tep_db_fetch_array($result)) { $table[$row['parent_id']][$row['categories_id']] = $row['categories_name']; } $output .= '<ul id="'.$idname_for_menu.'">'; $output .= tep_make_cat_ulbranch($rootcatid, $table, 0, $maxlevel); // Close off nested lists for ($nest = 0; $nest <= $GLOBALS['this_level']; $nest++) { $output .= '</ul>'; } return $output; } // Create the branches of the unordered list function tep_make_cat_ulbranch($parcat, $table, $level, $maxlevel) { global $cPath_array, $classname_for_selected, $classname_for_parent; $list = $table[$parcat]; while(list($key,$val) = each($list)){ if ($GLOBALS['this_level'] != $level) { if ($GLOBALS['this_level'] < $level) { $output .= "\n".'<ul>'; } else { for ($nest = 1; $nest <= ($GLOBALS['this_level'] - $level); $nest++) { $output .= '</ul></li>'."\n"; } /* if ($GLOBALS['this_level'] -1 == $level) $output .= '</ul></li>'."\n"; elseif ($GLOBALS['this_level'] -2 == $level) $output .= '</ul></li></ul></li>'."\n"; elseif ($GLOBALS['this_level'] -3 == $level) $output .= '</ul></li></ul></li></ul></li>'."\n"; elseif ($GLOBALS['this_level'] -4 == $level) $output .= '</ul></li></ul></li></ul></li></ul></li>'."\n"; */ } $GLOBALS['this_level'] = $level; } if (isset($cPath_array) && in_array($key, $cPath_array) && $classname_for_selected) { $this_cat_class = $classname_for_selected . ' '; $list_item_end = ''; } else { $this_cat_class = ''; $list_item_end = '</li>'; } if ($level == 2) { $prefix = '» '; } else { $prefix = ''; } $output .= '<li class="'.$this_cat_class.'cat_lev_'.$level.'"><a class="catlink lev_' .$level.''; if (tep_has_category_subcategories($key) && $classname_for_parent) { $this_parent_class = ' ' . $classname_for_parent; } else { $this_parent_class = ''; } $output .= $this_parent_class; $output .= '" href="'; if (!$level) { unset($GLOBALS['cPath_set']); $GLOBALS['cPath_set'][0] = $key; $cPath_new = 'cPath=' . $key; } else { $GLOBALS['cPath_set'][$level] = $key; $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1))); } $output .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'.$prefix.$val.'</a>'.$list_item_end."\n"; /*if (!tep_has_category_subcategories($key)) { $output .= '</li>'."\n"; }*/ if ((isset($table[$key])) AND (($maxlevel > $level + 1) OR ($maxlevel == '0'))) { $output .= tep_make_cat_ulbranch($key,$table,$level + 1,$maxlevel); } } // End while loop return $output; } ?> The change above is clean xhtml with correctly nested classes - hop eit helps someone... I also added this CSS to show only categories belonging to the parent you are in - you'll need to change the font-colours to your own though ... :) #categories { } #categories ul li { border-bottom:1px solid #ececec; } #categories a { display:block; width:170px; font-size:1.1em; } #categories a:hover { background-color:#ebe2eb; } #categories .catlink { padding:6px 0px; } #categories ul .selected .lev_1 { font-weight:bold; color:#671664; background-color:#f7f3f7; } /* hide all other parent cats */ #categories .cat_lev_0 { display:none; } /* heading for the cat we are in */ #categories .selected .lev_0 { width:160px; padding:5px 2px 5px 8px; font-size:1.5em; font-weight:normal !important; color:#fff !important; background:#671664 url("../../images/assets/purpleBG.gif") repeat-x top; } #categories .selected .lev_0:hover { color:#fff !important; } /* display the subcats */ #categories .selected { display:list-item; } #categories .selected .cat_lev_1 { border-bottom:1px solid #ececec; } /* heading for the second level cat we are in */ #categories .selected .parent { /*font-weight:bold; color:#671664;*/ } /* display the subcats */ #categories .selected .cat_lev_1 ul { border-top:1px solid #ccbacb; border-bottom:1px solid #ccbacb; background-color:#f7f3f7; } #categories .selected .cat_lev_1 ul .cat_lev_2 { border-bottom:none; } #categories .selected .cat_lev_1 ul .lev_2 { padding:3px 0px; padding-left:5px; width:165px; font-size:1em; background-color:#f7f3f7; } #categories .selected .cat_lev_1 ul .lev_2:hover { background-color:#ebe2eb; } /* third level cat we are in */ #categories .selected .selected .selected .lev_2 { font-weight:bold; color:#671664 !important; background-color:#ebe2eb !important; } Quote Link to comment Share on other sites More sharing options...
Guest Posted August 7, 2008 Share Posted August 7, 2008 hi i searched but no answer... i have sts4 and ulcategories setup. I am having a problem with using drop down menus on my horizontal menu, so I wish to eliminate the drop downs entirely and only show the categories page (the page that has the sub cats on it) as my site is nearly 90% css... how ever when I go to this page my sub categories are showing even though i have the show full tree function turned off. I would like: - the sub categories to not show at all - the top categories only to be visible on all pages thanks J Quote Link to comment Share on other sites More sharing options...
XenoPhage Posted August 29, 2008 Share Posted August 29, 2008 Hi, I have a problem with closing </li> tags. It seems that if a category has a subcategory there is no closing </li> tag. I'm baffled as to why this is happening. Anyone know which part of the code is affecting this? Thanks for any help. I also had this problem and spent the time tracking down why. I've fixed the problem and I have an updated ul_categories.php file as a result. I'd like to upload it to the site so others can test it, but I'm unsure if I should just upload it to the contribution, or if there's some other accepted way of handling this. In the meantime, you can download it here. If someone wants to double check my changes and verify that it works as advertised, I'd be happy to upload it to the contribution. Thanks! Quote XenoPhage Link to comment Share on other sites More sharing options...
Celebrimbor Posted September 29, 2008 Share Posted September 29, 2008 Im trying to use this contrib... but without sucess.. Im using STS and HTC.. but i think that isnt interfer... I put the CSS code below on my stylesheet but my categories still the same. I already change my left columm to include(DIR_WS_BOXES . 'ul_categories.php'); but still with no effect. My settings: $show_ulcats_as_box = true; $show_full_tree = true; $idname_for_menu = 'nav'; $classname_for_selected = 'selected'; $classname_for_parent = 'daddy'; $before_nobox_html = ''; $after_nobox_html = '<div style="clear: both;">'; #nav, #nav ul { /* all lists */ padding: 0; margin: 0; list-style: none; float : left; width : 11em; } #nav li { /* all list items */ position : relative; float : left; line-height : 1.25em; margin-bottom : -1px; width: 11em; background-color : white; } #nav li ul { /* second-level lists */ position : absolute; left: -999em; margin-left : 11.05em; margin-top : -1.35em; } #nav li ul ul { /* third-and-above-level lists */ left: -999em; } #nav li a { width: 11em; w\idth : 10em; display : block; color : black; font-weight : bold; text-decoration : none; border : 1px solid black; padding : 0 0.5em; } #nav li a:hover { color : white; background-color : black; } #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul { left: -999em; } #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul { /* lists nested under hovered list items */ left: auto; } /* Menu items with subcategories */ #nav a.daddy { background: url(images/arrow_green.gif) center right no-repeat; } /* Selected items with subcategories */ #nav li.selected { background-color: #FFCC00; } Any sugestions? Quote OScommerce Rocks! Link to comment Share on other sites More sharing options...
Kerstin Posted November 16, 2008 Share Posted November 16, 2008 Hi, I am using the Multi Store Contribution - can anybody advice on where to place the code in order to only display the categories of the current store? Please see below for part of current categories.php Many thanks for your help! Kerstin if ((GLOBAL_CURRENT_STORE_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']; } } } else { //if (GLOBAL_CURRENT_STORE_NAME <> '') { // $selection = tep_db_query("select categories_id from " . TABLE_CATEGORIES_STORES . " where categories_storename = '" . GLOBAL_CURRENT_STORE_NAME . "'"); // while ($selarray = tep_db_fetch_array($selection)) { // $catselection[]=$selarray[categories_id]; // } //} while ($categories = tep_db_fetch_array($categories_query)) { $checkcat = tep_db_query("select categories_id from " . TABLE_CATEGORIES_STORES . " where categories_storename = '" . GLOBAL_CURRENT_STORE_NAME . "' AND categories_id = '" . $categories['categories_id'] . "'"); if ($checkar = tep_db_fetch_array($checkcat)) { $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']; } } } } Quote Link to comment Share on other sites More sharing options...
leahdosa Posted November 17, 2008 Share Posted November 17, 2008 Im trying to use this contrib... but without sucess.. Im using STS and HTC.. but i think that isnt interfer... I put the CSS code below on my stylesheet but my categories still the same. I already change my left columm to include(DIR_WS_BOXES . 'ul_categories.php'); but still with no effect. My settings: $show_ulcats_as_box = true; $show_full_tree = true; $idname_for_menu = 'nav'; $classname_for_selected = 'selected'; $classname_for_parent = 'daddy'; $before_nobox_html = ''; $after_nobox_html = '<div style="clear: both;">'; #nav, #nav ul { /* all lists */ padding: 0; margin: 0; list-style: none; float : left; width : 11em; } #nav li { /* all list items */ position : relative; float : left; line-height : 1.25em; margin-bottom : -1px; width: 11em; background-color : white; } #nav li ul { /* second-level lists */ position : absolute; left: -999em; margin-left : 11.05em; margin-top : -1.35em; } #nav li ul ul { /* third-and-above-level lists */ left: -999em; } #nav li a { width: 11em; w\idth : 10em; display : block; color : black; font-weight : bold; text-decoration : none; border : 1px solid black; padding : 0 0.5em; } #nav li a:hover { color : white; background-color : black; } #nav li:hover ul ul, #nav li:hover ul ul ul, #nav li.sfhover ul ul, #nav li.sfhover ul ul ul { left: -999em; } #nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li.sfhover ul, #nav li li.sfhover ul, #nav li li li.sfhover ul { /* lists nested under hovered list items */ left: auto; } /* Menu items with subcategories */ #nav a.daddy { background: url(images/arrow_green.gif) center right no-repeat; } /* Selected items with subcategories */ #nav li.selected { background-color: #FFCC00; } Any sugestions? I am having the same issue. ...exactly as you. I also have STS. I did exactly as you...and getting no result. Quote Link to comment Share on other sites More sharing options...
jer001 Posted January 20, 2009 Share Posted January 20, 2009 I am having the same issue. ...exactly as you. I also have STS. I did exactly as you...and getting no result. Same here I got the contribution to work only on the categories but does not show my sub categories. Hopefully we will get this solved. I think it is STS and the tep_has_category_subcategories function but I am not too sure. Thanks jeremy Quote Link to comment Share on other sites More sharing options...
jer001 Posted January 21, 2009 Share Posted January 21, 2009 Same here I got the contribution to work only on the categories but does not show my sub categories.Hopefully we will get this solved. I think it is STS and the tep_has_category_subcategories function but I am not too sure. Thanks jeremy I fixed my problem using part of this contribution http://www.oscommerce.com/community/contri...ons,4667/page,3 Now I am having problems with another drop down menu for specials but I will figure it out Thank you Jeremy Quote Link to comment Share on other sites More sharing options...
jer001 Posted January 21, 2009 Share Posted January 21, 2009 I fixed my problem using part of this contributionhttp://www.oscommerce.com/community/contri...ons,4667/page,3 Now I am having problems with another drop down menu for specials but I will figure it out Thank you Jeremy Almost but I do not know why it is only taking out one of my specials and repeating it a million times untill my server times out please help thank you. This is my function to display my specials in a drop down function tep_show_category_menu_special($parent_id) { $special_sql = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC"; $categories_query_special = tep_db_query($special_sql); while ($specials = tep_db_fetch_array($categories_query_special)) { echo "<LI class='navigate'>"; echo "<a href='product_info.php?products_id=" . $specials['products_id']; if($parent_id ==0 ) echo ""; echo "'>".$specials['products_name']."</a></li>"; tep_show_category_menu_special($specials['products_id']); } } tep_show_category_menu_special(0); Quote Link to comment Share on other sites More sharing options...
jer001 Posted January 21, 2009 Share Posted January 21, 2009 Almost but I do not know why it is only taking out one of my specials and repeating it a million times untill my server times out please help thank you.This is my function to display my specials in a drop down function tep_show_category_menu_special($parent_id) { $special_sql = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC"; $categories_query_special = tep_db_query($special_sql); while ($specials = tep_db_fetch_array($categories_query_special)) { echo "<LI class='navigate'>"; echo "<a href='product_info.php?products_id=" . $specials['products_id']; if($parent_id ==0 ) echo ""; echo "'>".$specials['products_name']."</a></li>"; tep_show_category_menu_special($specials['products_id']); } } tep_show_category_menu_special(0); almost got it but no luck so far :( Quote Link to comment Share on other sites More sharing options...
vampirehunter Posted February 26, 2009 Share Posted February 26, 2009 Having installed this contribution, I noticed that for the top level categories, it did not have proper closing tags for the hyperlinks and the lists for the html. So i made a simple edit to one line in the ul categories file towards the bottom. $output .= ''; which is located just before this code right at the bottom of the page: if (!tep_has_category_subcategories($key)) { $output .= '</li>'."\n"; } now becomes: $output .= '</a></li>'; This now properly adds the closing tag to the hyperlink for each main category link, and also closes each list properly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.