[Contribution] Category Box as Nested Unordered List v1.0
#81
Posted 09 November 2009 - 03:45 AM
What's missing is another piece of logic that adds closing tags to the unselected siblings in the case where $show_full_tree is set to false.
I can see what needs fixing but I don't have the coding skills to fix it.
#82
Posted 06 February 2010 - 04:42 PM
After adding it to the boxes, I now have 2 Categories, the new one, and the original.
Any suggestions as to how I hide the original one?
#83
Posted 31 March 2010 - 08:24 PM
casemaker, on 06 February 2010 - 04:42 PM, said:
After adding it to the boxes, I now have 2 Categories, the new one, and the original.
Any suggestions as to how I hide the original one?
Look for the code in the file includes/column_left.php
it should look something like this:
include(DIR_WS_BOXES . 'categories.php');
All you need to do is comment out that line with two slashes like this:
// include(DIR_WS_BOXES . 'categories.php');
Worked for me. Basically, you're removing the request to show the original category box.
#84
Posted 01 April 2010 - 11:20 AM
and around line 21 change:
include(DIR_WS_BOXES . 'categories.php');
to
include(DIR_WS_BOXES . 'ul_categories.php');
Use latest ul_categories.php (from ul_categories closing tags fix2)
Gr.
#85
Posted 26 April 2010 - 07:31 PM
greetings!
#86
Posted 17 July 2010 - 06:01 PM
#87
Posted 20 July 2010 - 10:25 PM
4. add beetween tags <head></head> different stylesheets for IE etc.
<?php
if (ae_detect_ie())
{
echo '<link rel="stylesheet" type="text/css" href="stylesheet_cat_ie.css">';
}
else {
echo '<link rel="stylesheet" type="text/css" href="stylesheet_cat.css">';
}
?>
#88
Posted 23 July 2010 - 03:12 PM
CGhoST, on 20 July 2010 - 10:25 PM, said:
4. add beetween tags <head></head> different stylesheets for IE etc.
<?php
if (ae_detect_ie())
{
echo '<link rel="stylesheet" type="text/css" href="stylesheet_cat_ie.css">';
}
else {
echo '<link rel="stylesheet" type="text/css" href="stylesheet_cat.css">';
}
?>
Someone please answer this as im in the same position. Cant belive this has not been asked before or is the readme a new file and a mistake has crept in.
There is no mention of which file to add that code to . It reads as if you suposed to add it to the same file as the previous instruction but that file does not have any <head> tags so it cant be that one.
Sitting here waiting for an answer as i cant finish untill i get this info.
#89
Posted 24 July 2010 - 02:48 AM
fasterstill, on 23 July 2010 - 03:12 PM, said:
There is no mention of which file to add that code to . It reads as if you suposed to add it to the same file as the previous instruction but that file does not have any <head> tags so it cant be that one.
Sitting here waiting for an answer as i cant finish untill i get this info.
I am also very surprised no one asked this question but after many hrs and hrs and days and giving up on this contribution and coming back to it i have finally figured it out. For you and others that are still interested in this un-supported contribution then point 4 needs to be added to every file which is in the root directory of oscommerce. In default oscommerce all files inside /catalog/ need to have point 4 added just above the </head>.
Edited by CGhoST, 24 July 2010 - 02:49 AM.
#90
Posted 27 July 2010 - 11:07 AM
CGhoST, on 24 July 2010 - 02:48 AM, said:
ALL files in the root? you must be joking, must be 50 files. Can't think of a better reason not to use this contrib and find another.
Any sugestions? need a flyout menu urgent.
#91
Posted 29 July 2010 - 01:51 AM
I have a different problem... my subcategories are linking to the wrong place... instead of being index.php?cPath=1_6 it is going to index.php?cPath=6
Can anyone help me fix this?
Thanks
Denz
#92
Posted 04 September 2010 - 06:31 PM
My thought was to establish $parent_cat_id = $cPath_array[0]... but, where to insert this in the code, I can't seem to figure out.
For help in answering this, I've included the code, here:
<?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
http://www.oscommerce.com
Copyright (c) 2006 Nate Welch http://www.natewelch.com
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 = true;
// 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 = 'subcat';
// 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 = 'subcat_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 = 'subcat_parent';
$classname_for_child = 'subcat_child';
$classname_for_no_children = 'subcat_no_children';
// 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 = '<span class="subcat_heading">Subcategories</span><br /><div class="subcat">';
// 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 = '';
// END Configuration options
// Global Variables
$GLOBALS['this_level'] = 0;
$GLOBALS['last_parent_id'] = 0;
// If Top of store then do nothing:
if (sizeof($cPath_array) == 0 ) {
return '';
}
// 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' => 'Sub 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 = '';
// $parent_query = 'AND (c.parent_id = "0"';
if (isset($cPath_array)) {
$cPath_array_temp = $cPath_array;
foreach($cPath_array_temp AS $key => $value) {
if ($parent_query == '') {
$parent_query = 'AND (c.parent_id = "' . $value . '"';
} else {
$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 .= '<div id="'.$idname_for_menu.'">';
$rootcatid = $cPath_array[0];
// echo $rootcatid;
$output .= tep_make_cat_ulbranch($rootcatid, $table, 0, $maxlevel);
// Close off nested lists
for ($nest = 0; $nest <= $GLOBALS['this_level']; $nest++) {
$output .= '</div>';
}
$output .= '';
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];
$this_class = 'subcat_parent';
while(list($key,$val) = each($list)){
if ($GLOBALS['this_level'] != $level) {
if ($GLOBALS['this_level'] < $level) {
$output .= "\n".'<div id="subcat_nest_' . $GLOBALS['last_parent_id'] .'" class="subcat_nest_div">';
$this_class = 'subcat_child';
} else {
for ($nest = 1; $nest <= ($GLOBALS['this_level'] - $level); $nest++) {
$output .= '</div>'."\n";
$this_class = 'subcat_parent';
}
}
$GLOBALS['this_level'] = $level;
}
// if (isset($cPath_array) && in_array($key, $cPath_array) && $classname_for_selected) {
// $this_class = $classname_for_selected;
// } else {
// $this_class = 'subcat_no_children';
// }
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_class = $classname_for_parent;
$GLOBALS['last_parent_id'] = $key;
}
$output .= '<span class="'.$this_class .'">';
$output .= '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '"' . $this_parent_class ./*$this_cat_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>';
$div_id = 'subcat_nest_' . $key;
$img_id = 'subcat_nest_img_' . $key;
if (tep_has_category_subcategories($key)) {
$output .= '<img src="/images/icon_plus.gif" style="line-height: 18px; position: absolute; right: 0px; top: 3px;" id="' . $img_id .'" onclick="javascript: show_subnav_div(\'' . $div_id . '\', \'' . $img_id . '\');"></span>';
}
if (!tep_has_category_subcategories($key)) {
$output .= '</span><br />'."\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;
}
?>
#93
Posted 04 September 2010 - 08:29 PM
The winner gets a rewrite of osCommerce for FREE that kills all tables as soon as I'm done with this project: Tableless, XHTML/CSS osCommerce. We have the only stable copy that does NOT use templates.
I'll POST the rewrite of the contribution as a new contribution and credit you.
Please.
For some reason, I cant get my mind around this contribution.
Sean Rice
http://rasadesign.com
seanrice@rasadesign.com
#94
Posted 29 September 2010 - 09:59 AM
I belive i have found an answer.
My list validates and looks good so i guess all tags are closed properly.
My menu has not been closing <li> when a category with subcats is not selected.
Here is the code that closes li tags if the category does not have subcats
if (!tep_has_category_subcategories($key)) {
$output .= '</li>'."\n";
}
add this to the bottom
elseif($_GET['cPath'] != $key)
{$output .= '</li>'."\n"; }
This basically says if the category is not selected close the tag.
If anyone finds a fault please let me know.
#95
Posted 25 November 2010 - 01:26 PM
I'm having trouble installing "[Contribution] Category Box as Nested Unordered List". I have copied across the ul_categories.php file into it's correct location and included all of the other code mentioned in the readme file. However, when I view the page, i receive the following errors
Notice: Undefined variable: output in /home/saltash/public_html/store/includes/boxes/ul_categories.php on line 116 Notice: Undefined variable: output in /home/saltash/public_html/store/includes/boxes/ul_categories.php on line 178 Notice: Undefined variable: output in /home/saltash/public_html/store/includes/boxes/ul_categories.php on line 141 Notice: Undefined variable: output in /home/saltash/public_html/store/includes/boxes/ul_categories.php on line 141 Notice: Undefined variable: output in /home/saltash/public_html/store/includes/boxes/ul_categories.php on line 141 Fatal error: Class 'infoBoxKategorie' not found in /home/saltash/public_html/store/includes/boxes/ul_categories.php on line 75Has anyone else received the same errors or know what might be causing them?
Many thanks,
James
Edited by brants, 25 November 2010 - 01:27 PM.
#96
Posted 08 December 2010 - 08:24 PM
if ( $tree[$counter]['path'] == '123_32' ) $categories_string .= 'http://www.external_site.com" target="_blank">'; else $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
into ul_categories.php. I assume that the file uses different strings but since i'm not a developer i can't do it. The original thread is here:http://forums.oscommerce.com/topic/355260-sub-category-link-to-an-external-site
any help is appreciated.
cheers
#97
Posted 29 December 2010 - 01:36 PM
Used this contibution on my site (Category Box as Nested Unordered List v1.1.3 )and it does just what it says on the Tin, I would love to continue to use it but it has slowed my site down considerably, i took it off and speed up again, tried reinstalling it but its the same.
I have over 300/400 cats/sub cats and assume this is the problem, has anyone had the same problem and if so got a work around
Thank you for any imput
Kind Regards
David
#98
Posted 27 November 2011 - 09:41 AM
I'm using the OSC-CSS add on, and trying to implement some of Yahoo's YUI modules, etc. I'd like to get a YUI3 menu working with my store such as this one.
http://yuilibrary.com/yui/docs/node-menunav/menunav-leftnav.html
Anyone done this yet with YUI3? I'd be thankful for someone to help me out on getting this my categories menu talking to this. Thanks!!
Steve
#99
Posted 09 February 2012 - 08:36 PM
gr8sale, on 14 July 2007 - 05:51 AM, said:
Help is appreciated [img]http://forums.oscommerce.com/public/style_emoticons/default/biggrin.gif[/img]
Stephanie
I have the same problem. I would like to have two menus on my STS template. I have spent hours trying to do this, but with no success. Can someone please help?









