nathan_ Posted June 28, 2009 Share Posted June 28, 2009 I can not get the subcategories to show up on any of my pages, not sure what Im missing.. Thanks in advance for your help guys ! <?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)) { $p_pic_sub = '<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) . '</a>'; $p_name_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a>'; $rows++; $cPath_new = tep_get_path($categories['categories_id']); $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%'; echo ' <td align="center" width="' . $width . '"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td style="height:16px " align="center" class="vam"><span>'.$p_name_sub.'</span></td> </tr> <tr> <td style="height:95px " align="center" class="pic" >'.tep_draw_prod_pic_top().''.$p_pic_sub.''.tep_draw_prod_pic_bottom().'</td> </tr> </table> </td> ' . "\n"; if ($col!=(MAX_DISPLAY_CATEGORIES_PER_ROW-1)){ echo ' <td class="bg_line_y">'.tep_draw_separator('spacer.gif', '1', '1').'</td> '; } else{ if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) { echo ' </tr><tr><td class="bg_line_x" colspan="'.(MAX_DISPLAY_CATEGORIES_PER_ROW + MAX_DISPLAY_CATEGORIES_PER_ROW -1).'">'.tep_draw_separator('spacer.gif', '1', '10').'</td></tr>' . "\n"; echo ' <tr>' . "\n"; } } if ($col==MAX_DISPLAY_CATEGORIES_PER_ROW-1){ $col=0; }else{ $col++; } } // needed for the new products module shown below $new_products_category_id = $current_category_id; ?> </table> Quote Link to comment Share on other sites More sharing options...
nathan_ Posted June 28, 2009 Author Share Posted June 28, 2009 Heres a pic of the structure with in the ADMIN panel, The website, I do have items in both sub categories Quote Link to comment Share on other sites More sharing options...
cooperman435 Posted June 29, 2009 Share Posted June 29, 2009 I believe in your case that he subcategories should be shown in the main window only? if you click on the main category do the sub categories then show in the side bar on the website? I'm trying currently to get subcategories to show in the main window all the time. If there are products in the category also, the subcategories disappear and show only on the side bar and are missed by everyone. Quote Link to comment Share on other sites More sharing options...
bbworld Posted June 30, 2009 Share Posted June 30, 2009 Hi. I'm having some similar issues. When I create a category it doesn't show up on the main screen with a picture, only in the tree-menu on the left When I create a sub-category I have the same problem. I've seen examples of how sub-categories should show (on the main screen with their picture) but again they just appear in the tree menu Is it possible to make sub-sub categories? Everything appears fine in the admin page where I create the categories and I have done everything right as far as I know - put in products in stock and given sub-categories names, pictures etc. The categories do technically work, but can only be accessed through the tree-menu which is impractical and doesn't look good. From all the other sites I've seen they all have sub-categories showing on the main screen with pictures etc. Any help would be greatly appreciated. My website is www.bbworld.co.uk. Quote Link to comment Share on other sites More sharing options...
celltoyz Posted December 9, 2009 Share Posted December 9, 2009 i hope this is the question you wanted answered. if i understand correctly you want people to be able to see the sub category images like it does with the main category on the top of the page. It's nothing you're doing wrong or nothing you screwed up, it just the way the site was designed. All you have to do is open up your index.php page and enter the following code underneath // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); For me that was line 187 but i have made alot of changes to my admin page Enter this code underneath <table> $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"; } } </table> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td>We are still undergoing major renovations to our website; as such many products are not yet available online. If there is a product you are looking for please email us via the contact us button on the top corner of the screen use the live help button to the left. <?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td> </tr> <!--- BEGIN Header Tags SEO Social Bookmarks --> <?php if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true') include(DIR_WS_MODULES . 'header_tags_social_bookmarks.php'); ?> <!--- END Header Tags SEO Social Bookmarks --> </table></td> it should work like it does here at Cellular Toy Shoppe Cell Toyz Quote Link to comment Share on other sites More sharing options...
RMD27 Posted May 6, 2010 Share Posted May 6, 2010 i hope this is the question you wanted answered. if i understand correctly you want people to be able to see the sub category images like it does with the main category on the top of the page. It's nothing you're doing wrong or nothing you screwed up, it just the way the site was designed. All you have to do is open up your index.php page and enter the following code underneath // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); For me that was line 187 but i have made alot of changes to my admin page Enter this code underneath <table> $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"; } } </table> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td>We are still undergoing major renovations to our website; as such many products are not yet available online. If there is a product you are looking for please email us via the contact us button on the top corner of the screen use the live help button to the left. <?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td> </tr> <!--- BEGIN Header Tags SEO Social Bookmarks --> <?php if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true') include(DIR_WS_MODULES . 'header_tags_social_bookmarks.php'); ?> <!--- END Header Tags SEO Social Bookmarks --> </table></td> it should work like it does here at Cellular Toy Shoppe Cell Toyz Sorry :blush: , I dont understand exactly what this code does. I want products to appear in categories that also have subcategories. Ie in the category page you have the products in that category at the top and underneath you have the sub category links (or vice versa). Is this what the code does? Quote Link to comment Share on other sites More sharing options...
RMD27 Posted May 6, 2010 Share Posted May 6, 2010 Sorry :blush: , I dont understand exactly what this code does. I want products to appear in categories that also have subcategories. Ie in the category page you have the products in that category at the top and underneath you have the sub category links (or vice versa). Is this what the code does? OK, no worries, with KissMT I can do what I need to Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.