renzo.verschoor Posted October 14, 2013 Share Posted October 14, 2013 I want to have a split screen of the category, sub-category, etc.....does anyone knows how to do this??....see picture attached for example.... Link to comment Share on other sites More sharing options...
♥kymation Posted October 14, 2013 Share Posted October 14, 2013 Not exactly what your image shows, but take a look at the Superfish Categories Box (see link below.) Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
renzo.verschoor Posted October 15, 2013 Author Share Posted October 15, 2013 Hi Jim, Thanks for your reply. To be honest, I'm really trying to do more as mentioned on the image i posted. Maybe you can help me with it?? The code I have today is as follow: $categories_array = array(array('id' => '', 'text' => TEXT_NONE)); $categories_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and b.language_id = " . (int)$language_id . " order by categories_id"); while ($categories = tep_db_fetch_array($categories_query)) { echo $categories['parent_id']; // $parent_id = $categories['parent_id']; if ($parent_id==0) { $categories_array[] = array('id' => $categories['categories_id'], 'text' => $categories['categories_name']); } else { $txt=NULL; while ($parent_id!=0) { //echo $parent_id; $category_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and a.categories_id = " . $parent_id . " and b.language_id = " . (int)$language_id . " order by categories_name"); $category = tep_db_fetch_array($category_query); $txt .=$category['categories_name']."->" ; $parent_id = $category['parent_id']; //die($txt.$parent_id.$category['categories_id']); } $categories_array[] = array('id' => $categories['categories_id'], 'text' => $txt.$categories['categories_name']); } This is being loaded into a pulldown box: <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('category_id', $categories_array, $pInfo->categories_id); ?></td> Would you or anybody else be able to advise how I need to split the subcats from the category and place them seperate in a pulldown box (or in the boxes mentioned on the image ) Thanks in advance. Link to comment Share on other sites More sharing options...
♥kymation Posted October 15, 2013 Share Posted October 15, 2013 Sorry, but that's more than I have time to do right now. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
renzo.verschoor Posted October 17, 2013 Author Share Posted October 17, 2013 thats a pitty :( anybody else can give me a hand? Link to comment Share on other sites More sharing options...
♥joli1811 Posted October 17, 2013 Share Posted October 17, 2013 Never seen anything like that but maybe a starting point if you are building your own would be http://addons.oscommerce.com/info/4201 Regards Joli To improve is to change; to be perfect is to change often. Link to comment Share on other sites More sharing options...
renzo.verschoor Posted October 19, 2013 Author Share Posted October 19, 2013 have some steps made...but now i again need some help.... what do I have until now....this is my 'tep_draw_pull_down_menu' code including the call onchange function on javascript: <td class="main" width="33%" align="center"><?php echo tep_draw_pull_down_menu('category_id', $categories_array, $pInfo->categories_id, 'onchange="updateCatSub1()" size="10"'); ?></td> <td class="main" width="33%" align="center"><?php echo tep_draw_pull_down_menu('catsub1_id', $catsub1_array, $pInfo->categories_id, 'onchange="updateCatSub2()" size="10"'); ?></td> <td class="main" width="33%" align="center"><?php echo tep_draw_pull_down_menu('catsub2_id', $catsub2_array, $pInfo->categories_id, 'size="10"'); ?></td> </tr> <script type="text/javascript"><!-- updateCatSub1(); //--></script> <script type="text/javascript"><!-- updateCatSub2(); //--></script> then the following code is my array to fill the first pull_down menu (category_id): $categories_array = array(array('id' => '', 'text' => TEXT_NONE)); $categories_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and parent_id = '0' and b.language_id = " . (int)$language_id . " order by categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { //echo $categories['parent_id']; $parent_id = $categories['parent_id']; if ($parent_id==0) { $categories_array[] = array('id' => $categories['categories_id'], 'text' => $categories['categories_name']); } else { $txt=NULL; while ($parent_id!=0) { //echo $parent_id; //$category_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and a.categories_id = " . $parent_id . " and b.language_id = " . (int)$language_id . " order by categories_id"); $category_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and parent_id = '0' and b.language_id = " . (int)$language_id . " order by categories_id"); $category = tep_db_fetch_array($category_query); $txt .=$category['categories_name']."->" ; $parent_id = $category['parent_id']; //die($txt.$parent_id.$category['categories_id']); } $categories_array[] = array('id' => $categories['categories_id'], 'text' => $txt.$categories['categories_name']); } and then at last the catsub1 (catsub1_id) and catsub2 (catsub2_id) pull_down menus: <script language="javascript"><!-- function updateCatSub1() { var selected_value = document.forms["new_product"].category_id.selectedIndex; var parameterCat1 = document.forms["new_product"].category_id[selected_value].value; if (parameterCat1 = 0 ) { [color=#ff0000]//this if statement is not doing the job, could some one advise how to do this???[/color] <?php $catsub1_array = array(array('id' => '', 'text' => TEXT_NONE)); $catsub1_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and parent_id = '1' and b.language_id = " . (int)$language_id . " order by categories_name"); while ($catsub1 = tep_db_fetch_array($catsub1_query)) { $catsub1_array[] = array('id' => $catsub1['categories_id'], 'text' => $catsub1['categories_name']); } ?> } else { <?php $catsub1_array = array(array('id' => '', 'text' => TEXT_NONE)); ?> } } //--></script> <script language="javascript"><!-- function updateCatSub2() { var selected_value = document.forms["new_product"].catsub1_id.selectedIndex; var parameterCat2 = document.forms["new_product"].catsub1_id[selected_value].value; if (parameterCat2 = ) { [color=#ff0000]//this if statement is not doing the job, could some one advise how to do this???[/color] <?php $catsub2_array = array(array('id' => '', 'text' => TEXT_NONE)); $catsub2_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and parent_id = '2' and b.language_id = " . (int)$language_id . " order by categories_name"); while ($catsub2 = tep_db_fetch_array($catsub2_query)) { $catsub2_array[] = array('id' => $catsub2['categories_id'], 'text' => $catsub2['categories_name']); } ?> } else { <?php $catsub2_array = array(array('id' => '', 'text' => TEXT_NONE)); ?> } } //--></script> and yes the code is not that clean and maybe sometimes more less fast and dirty.....but the pull_down menus are filled with the info i need.....the only thing which is not working, which i need, is the if statement in both catsubs So at start the catsub1 pull_down menu should be empty untill i select anything from the category pull_down menu and this also counts for the catsub2 pull_down menu as this one only need to be filled when a selection on the catsub1 pull_down menu have been done... Thanks in advance. Link to comment Share on other sites More sharing options...
renzo.verschoor Posted October 21, 2013 Author Share Posted October 21, 2013 after a lot of code changing i finally go it working.....(removed all the javascript coding as that was a pain in the ***) Link to comment Share on other sites More sharing options...
PupStar Posted October 21, 2013 Share Posted October 21, 2013 please share the code so that others may benefit from it. Mark Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.