theseason Posted May 27, 2004 Share Posted May 27, 2004 Currently on my index page in the catalog, the menu is collapsable. When you click on a top category, the page reloads, the menu expands to show sub categories, and the main body shows the category name and the images for the subcategories. I want to customize it so that when I click on the collapsed menu, everything above happens, except there will be a description that pops up for that category instead of the subcategory images. I know I can keep the subcategory images from showing by removing the following: <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <?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; ?> </tr> </table> Any bright ideas out there? thanks for taking a look. A Link to comment Share on other sites More sharing options...
theseason Posted May 28, 2004 Author Share Posted May 28, 2004 I tried using the contribution that has the category tree always expanded to avoid the situation altogether. Well, I got an error. 1054 - Unknown column 'c.status' in 'where clause'select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where c.status = '1' and c.parent_id = 0 and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name [TEP STOP] Does this look familiar? My two main categories have a sort order of 1 and 2. Does one have to be 0? Any help is greatly appreciated. A Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.