GoneShootin Posted February 25, 2005 Share Posted February 25, 2005 I am testing Category Tabs and Subs. I have 14 categories currently in action (beta site: http://www.theteddybearvillage.net/store). Is it possible to change the number of tabs shown per row? As you can see above it currently flies off the page. I assume its in and around //categories_tab.php <?php // needed in case other part of site use same variable. $categories_string=''; unset ($first_element); unset ($prev_id); if (CAT_TABS_SHOW_HOME) { $foo[0]=array( 'name' => HEADER_TITLE_TOP, 'parent' => '', 'level' => 0, 'path' => '', 'next_id' => false ); $prev_id=0; $first_element=0; } $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='" . $languages_id ."' ".$cfg_query_and." order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $foo[$categories['categories_id']] = array( 'name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $categories['categories_id']; } $prev_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } $last_element=$categories['categories_id']; } show_category_tabs($first_element, $last_element); echo $categories_string; ?> Thanks contributions: Another breadcrumb hack Link to comment Share on other sites More sharing options...
burt Posted February 25, 2005 Share Posted February 25, 2005 Try sticking in a limit like this: order by sort_order, cd.categories_name LIMIT 6 The tabbed effect doesn't work at all well if you have more than a few categories...you might want to reconsider using it at all... Link to comment Share on other sites More sharing options...
GoneShootin Posted March 1, 2005 Author Share Posted March 1, 2005 It seems I wasnt using the contrib I thought I was using. Found another one with admin options. Try sticking in a limit like this: order by sort_order, cd.categories_name LIMIT 6 The tabbed effect doesn't work at all well if you have more than a few categories...you might want to reconsider using it at all... <{POST_SNAPBACK}> contributions: Another breadcrumb hack Link to comment Share on other sites More sharing options...
itsjust Posted March 9, 2008 Share Posted March 9, 2008 Try sticking in a limit like this: order by sort_order, cd.categories_name LIMIT 6 The tabbed effect doesn't work at all well if you have more than a few categories...you might want to reconsider using it at all... That works well to only show 6 categories and no more thanks :) Would you maybe also know how to make the subcategories only show one level of the subcategories_string. For exsample level 3 (subcat>subcat>subcat) if ($cPath) { $subcategories_string = ''; $new_path = ''; $id = split('_', $cPath); reset($id); while (list($key, $value) = each($id)) { unset($prev_id); unset($first_id); $subcategories_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 = '" . $value . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); $subcategory_check = tep_db_num_rows($subcategories_query); if ($subcategory_check > 0) { $new_path .= $value; while ($row = tep_db_fetch_array($subcategories_query)) { $fooa[$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($prev_id)) { $fooa[$prev_id]['next_id'] = $row['categories_id']; } $prev_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } $fooa[$last_id]['next_id'] = $fooa[$value]['next_id']; $fooa[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } if ($id[0] != ''){ show_subcategories($id[0]); echo $subcategories_string; }else{ echo " "; } Link to comment Share on other sites More sharing options...
itsjust Posted March 10, 2008 Share Posted March 10, 2008 Would you maybe also know how to make the subcategories only show one level of the subcategories_string. For exsample level 3 (subcat>subcat>subcat) Well I found some kind of solution by using this if statement if ($fooa[$counter]['level'] == 3) { } In the following way // display category name if ($fooa[$counter]['level'] <= 2) { $subcategories_string .= $fooa[$counter]['name']; } $subcategories_string .= '</a> '; if ($fooa[$counter]['next_id']) { if ($fooa[$counter]['level'] <= 2) { $subcategories_string .= ' '; } show_subcategories($fooa[$counter]['next_id']); }else{ $subcategories_string .= ' '; } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.