julinhu00 Posted January 2, 2009 Share Posted January 2, 2009 Hello, I would be help. When I click on the category, as do the menu shows only the category that was clicked and their subs? can you help me? :lol: Link to comment Share on other sites More sharing options...
julinhu00 Posted January 2, 2009 Author Share Posted January 2, 2009 ... Link to comment Share on other sites More sharing options...
roya.k Posted January 2, 2009 Share Posted January 2, 2009 Please give me an example site showing what you want and need exactly. Open source n'est pas un échange à sens unique ... La plupart du temps un simple merci ou quelques mots d'encouragement suffisent... Link to comment Share on other sites More sharing options...
julinhu00 Posted January 2, 2009 Author Share Posted January 2, 2009 ok.. click on a category ... and see the change in the menu http://www.playtech.com.br/default.asp Link to comment Share on other sites More sharing options...
roya.k Posted January 3, 2009 Share Posted January 3, 2009 You can try this code. Go to includes/boxes/ and make a copy of your current categories.php file (backup) then replace the content of categories.php file with this code: <?php /* $Id: categories.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ /* categories.php - Modification : Roya - 3 janvier 2009 */ /* Settings:*/ /****************************************************************/ /* if you want to display all subcategories in home page , set this to true */ $show_subcat_in_home = false; /* is added before each category */ $add_before_cat = '<b>'; /* is added after each category */ $add_after_cat = '</b><br>'; /* is added before each subcategory */ $add_before_sub = ' '; /* is added after each subcategory */ $add_after_sub = '<br>'; /****************************************************************/ function is_child_of($child_id, $parent_id) { $child_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$parent_id . "'"); if (tep_db_num_rows($child_categories_query)) { while ($child_categories = tep_db_fetch_array($child_categories_query)) { if ($child_categories['categories_id'] == $child_id) return true; } } return false; } function rk_show_cat($parent=0) { global $languages_id, $current_category_id, $cPath_array, $cPath; global $show_subcat_in_home, $add_before_cat, $add_after_cat, $add_before_sub, $add_after_sub; $return =''; $has_sub = false; $cPath_new = ''; $cat_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 = '" . $parent . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by cd.categories_name"); while ($cat = tep_db_fetch_array($cat_query)) { if (is_child_of($current_category_id, $cat['categories_id'])) { $cp_size = sizeof($cPath_array); $last_category_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$cPath_array[($cp_size-1)] . "'"); $last_category = tep_db_fetch_array($last_category_query); $return .= $add_before_cat.'<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath='. $last_category['parent_id']) . '">' . $cat['categories_name'] .'</a>'.$add_after_cat; } $cPath_new = tep_get_path($cat['categories_id']); if (($cat['categories_id'] == $current_category_id) || ($current_category_id==0) || (is_child_of($cat['categories_id'], $current_category_id)) ) { if (tep_has_category_subcategories($cat['categories_id'])) {$has_sub = true;} if (!$has_sub){ $return .= $add_before_sub; } else { if ($parent!=0) { $return .= $add_before_sub;} else {$return .= $add_before_cat;} } $return .= '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' .$cat['categories_name'].'</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($cat['categories_id']); if ($products_in_category > 0) { $return .= ' (' . $products_in_category . ')'; } } if (!$has_sub) { $return .= $add_after_sub; } else { if ($parent!=0) { $return .= $add_after_sub;} else {$return .= $add_after_cat;} } } $new_cat = $cat['categories_id']; if (tep_has_category_subcategories($new_cat)) { if ($current_category_id==0){ if ($show_subcat_in_home) $return .= rk_show_cat($new_cat); } else { $return .= rk_show_cat($new_cat); } } } return $return; } ?> <!-- 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 = rk_show_cat(); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); ?> </td> </tr> <!-- categories_eof //--> Open source n'est pas un échange à sens unique ... La plupart du temps un simple merci ou quelques mots d'encouragement suffisent... Link to comment Share on other sites More sharing options...
julinhu00 Posted January 4, 2009 Author Share Posted January 4, 2009 Hello Roya Khosravi, thank you for your help ... I was a little lost in the code but helped me a lot ... add me on msn [email protected] Link to comment Share on other sites More sharing options...
julinhu00 Posted January 4, 2009 Author Share Posted January 4, 2009 hi, because the menu in Internet Explorer is centralized? someone help me? Link to comment Share on other sites More sharing options...
julinhu00 Posted January 5, 2009 Author Share Posted January 5, 2009 ex. www.megasom.com.br Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.