Guest Posted March 14, 2007 Posted March 14, 2007 I've got a category-question that I've been trying to solve on my own for about two days now... :blink: 1. When clicking on a main category in the left menu I don't want the subcategories to show up at the main page, only as text links in the left menu. I want the main page (where the products are listed) to stay the same until you click on a subcategory. Possible and if so, how? Eternally grateful for some assistance... :huh:
Guest Posted March 14, 2007 Posted March 14, 2007 Comment them out or remove the following code in the index.php file. starting at line 79 all the way till 113 <?php if (isset($cPath) && strpos('_', $cPath)) { // check to see if there are deeper categories within the current category $category_links = array_reverse($cPath_array); for($i=0, $n=sizeof($category_links); $i<$n; $i++) { $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'"); $categories = tep_db_fetch_array($categories_query); if ($categories['total'] < 1) { // do nothing, go through the loop } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); break; // we've found the deepest category the customer is in } } } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); } $number_of_categories = tep_db_num_rows($categories_query); $rows = 0; while ($categories = tep_db_fetch_array($categories_query)) { $rows++; $cPath_new = tep_get_path($categories['categories_id']); $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%'; echo ' <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n"; if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) { echo ' </tr>' . "\n"; echo ' <tr>' . "\n"; } } // needed for the new products module shown below $new_products_category_id = $current_category_id; ?> That will do the trick I've got a category-question that I've been trying to solve on my own for about two days now... :blink: 1. When clicking on a main category in the left menu I don't want the subcategories to show up at the main page, only as text links in the left menu. I want the main page (where the products are listed) to stay the same until you click on a subcategory. Possible and if so, how? Eternally grateful for some assistance... :huh:
Guest Posted March 14, 2007 Posted March 14, 2007 Do you drink coffee Kevin? I'll make you a fresh pot every morning for helping me... :thumbsup: It worked like a charm!
Guest Posted March 14, 2007 Posted March 14, 2007 Happy to hear it. If you need anything else you let me know. Do you drink coffee Kevin?I'll make you a fresh pot every morning for helping me... :thumbsup: It worked like a charm!
MrBrzoza Posted March 14, 2007 Posted March 14, 2007 Hello, I have similar problem, but i need do some more changes. I have oscommerce template from MonterTemplates. I changed the main page of categories, and i dont have sub categories on main page. I would like to aslo to display products ftom subcategories when i choose main category. Example: - category - subcategory1 - subcategory2 Is it possible to change code to list all product from both subcategories on main page when choosing main category and then when choosing subcategory only the products in this sub category. Sorry for my english, Regards Leszek
Guest Posted November 27, 2007 Posted November 27, 2007 hi, i do like your instruction and 1 problem happens. when you click on a main category, it always list new products. what i want is when clicking the main category, it will list all products in that category (includes all its subcategories) any help
Recommended Posts
Archived
This topic is now archived and is closed to further replies.