mightphill Posted February 15, 2008 Posted February 15, 2008 K so I'm not up to it with php - I'm a designer and coding does my head in - so question is can some help change the php code below to only show one level of subcategories. This is the file that I'm using to display the category box - I'm using an html template and calling the php with $usercategory2 - but it displays all the sub categories - have tried using some of the other php category files but this is the closest one to what I'm after. Any help would be wicked awesome - cheers in advance... here's the usercategory2.php file <?php function tep_show_usercategory() { global $categories_string, $categories_header, $categories_footer, $languages_id, $HTTP_GET_VARS; global $level; $selectedPath = array(); // Get all of the categories on this level $fileexist="false"; $categories_query = tep_db_query("select c.categories_id, c.level, cd.categories_name, cd.categories_heading_title, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_heading_title"); while ($categories = tep_db_fetch_array($categories_query)) { // Add category link to $categories_string $cPath_new = $categories['categories_id']; $cPath_new_text = "cPath=" . $cPath_new; $z_tmpfile=STS_TEMPLATE_DIR . "categorylevel".$categories['level'].".html"; if (file_exists($z_tmpfile)) { $z_fh = fopen($z_tmpfile, 'r'); $z_tmp = fread($z_fh, filesize($z_tmpfile)); fclose($z_fh); $z_tmp = str_replace("\$url", tep_href_link(FILENAME_DEFAULT, $cPath_new_text), $z_tmp); $z_tmp = str_replace("\$longname", $categories['categories_name'], $z_tmp); $categories_string .= $z_tmp; } else { $categories_string .= "<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td valign='top'>"; $categories_string .= "<img src='images/pixel_trans.gif' height=1 width=" . ($categories['level']*5) . ">"; $categories_string .= '<a class="boxtext" href="'; $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new_text); $categories_string .= '">'; $categories_string .= $categories['categories_name']; $categories_string .= '</a></td></tr></table>'; } } // if (AUCTION_CATEGORY=='true') { // } } ?> <!-- categories //--> <?php echo theme_boxstart("categorybox"); $categories_header = '<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td>'; $categories_string = ''; $categories_footer = '</td></tr></table>'; tep_show_usercategory(); $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_header . $categories_string . $categories_footer); // new infoBoxPlain($info_box_contents); echo $categories_header . $categories_string . $categories_footer; echo theme_boxend("categorybox"); ?> <!-- categories_eof //-->
johnnytli Posted February 15, 2008 Posted February 15, 2008 Looks like you are not working with the original osCommerce files. Whoever modified it can probably do it for you. I tried to solve it but realized that I don't know what the tep_show_usercategory() function do. So if you need more help you need to find and post that function.
mightphill Posted February 15, 2008 Author Posted February 15, 2008 Hey thanks for trying - I thought that might be the case - yes the files are moded to integrate with a desktop admin program so it all gets a bit messy when trying to do script mods... especially when I've got no idea either... haha oh well... THANKS again... I'll try to figure out the mods and if I do I'll post with more detail - could take me the beter part of the next decade to work out though... CHEERS
Recommended Posts
Archived
This topic is now archived and is closed to further replies.