shaytaan Posted September 26, 2005 Posted September 26, 2005 Hello friends, I want to list my products while viewing subcategories sorted by category name please check the below screenshot screenshot I'm fighting with index.php to make it work but my PHP knowledge is not supporting me :( I'll continue fighting and need some help from you guys PLease help :blush: thanks ?,???`???,?? God must love stupid people, he made so many ??,???`???,?
jeffy777 Posted September 26, 2005 Posted September 26, 2005 lol, I'm working on building something just like that :)
shaytaan Posted September 26, 2005 Author Posted September 26, 2005 lol, I'm working on building something just like that :) Good :) then we are two for making it... Please check/modify if we can you make something from this code? <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><?php if (isset($HTTP_GET_VARS['manufacturers_id'])) { }else{ if (isset($cPath)) { if (ereg('_', $cPath)) { $category_links = array_reverse($cPath_array); $cat_to_search = $category_links[0]; } else { $cat_to_search = $cPath; } $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 = '" . $cat_to_search . "' 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) > 0 ) { $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) . '">' . 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 != tep_db_num_rows($categories_query))) { echo ' </tr>' . "\n"; echo ' <tr>' . "\n"; } } } } } ?></tr></table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> ?,???`???,?? God must love stupid people, he made so many ??,???`???,?
jeffy777 Posted September 26, 2005 Posted September 26, 2005 I already have the display part working. As far as whether or not the product listing for the subcategory displays was going to be something that could be enabled from each cateogry in the admin panel, so my code is a bit different from yours, but your approach looks good as well :thumbsup: Does it work at all?
shaytaan Posted September 26, 2005 Author Posted September 26, 2005 I already have the display part working. As far as whether or not the product listing for the subcategory displays was going to be something that could be enabled from each cateogry in the admin panel, so my code is a bit different from yours, but your approach looks good as well :thumbsup: Does it work at all? No, the code I posted is not the same as the screenshot :( May I have your code please :D ?,???`???,?? God must love stupid people, he made so many ??,???`???,?
jeffy777 Posted September 26, 2005 Posted September 26, 2005 Well since I don't have the admin part done yet, I specify within index.php which categories I want to display the product list for their sub-cats. So that may be a problem for you at this point if you have a ton of main categories that you want to use this for. But I will be working on the admin part soon... The other limitation to this code is that I custom built it for the shop I am working on, and the shop only has categories that are three levels deep (main cateory -> sub cats -> more sub cats -> products), so I wrote the code with that in mind. In it's current state, when you click a main category it will then display the subcats, then you click a sub cat and it displays the subcats within and their products (similiar to your screenshot) but it won't display any deeper categories.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.