ronsts Posted February 10, 2003 Share Posted February 10, 2003 Does anyone know of any mods or contributions that will display in the categories infobox, only the main categories in list box format. I have tried using several contributions, but it includes the categories as well as the sub categories within the list box. In addition to this, is it possible to have another infobox open displaying the sub-categories when one of the top level categories is clicked in the categories infobox. I have made attempts by taking this info from the default.php page, and creating an infobox with this code, but it turns out looking pretty screwy. if ($cPath && ereg('_', $cPath)) { // check to see if there are deeper categories within the current category $category_links = array_reverse($cPath_array); $size = sizeof($category_links); for($i=0; $i<$size; $i++) { $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 = '" . $category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query) < 1) { // do nothing, go through the loop } else { 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 = '" . $current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' order by sort_order, cd.categories_name"); } $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" style="width: ' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "n"; echo ' <td align="center" class="smallText" style="width: ' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '">' . '<br>' . $categories['categories_name'] . '</a></td>' . "n"; if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != tep_db_num_rows($categories_query))) { echo ' </tr>' . "n"; echo ' <tr>' . "n"; } } ?> I am fairly new to scripting and oscommerce, but have never come across such a great customizeable ecommerce solution. Link to comment Share on other sites More sharing options...
stevek1977 Posted February 11, 2003 Share Posted February 11, 2003 i would like to do the same thing. anyone have any idea of how to do this? Link to comment Share on other sites More sharing options...
Guest Posted February 11, 2003 Share Posted February 11, 2003 Maybe this will help. http://www.oscommerce.com/forums/viewtopic.php?t=33066 Link to comment Share on other sites More sharing options...
stevek1977 Posted February 11, 2003 Share Posted February 11, 2003 i actually just grabbed that a minute ago and got it setup and working. now i need to create one that ONLY lists the subcategories....any thoughts on the query for that? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.