function tep_build_cat_pull_down(&$cat_select, $prfx, $cat_tree = NULL, $pr = '') { if (!isset($cat_tree)) { $cat = tep_get_category_info(); $cat_tree = $cat['tree']; } foreach ($cat_tree as $cat_info) { $cat_select[] = array(id => $cat_info['id'], text => $pr . $cat_info['name']); if (isset($cat_info['tree'])) { tep_build_cat_pull_down($cat_select, $prfx, $cat_info['tree'], $pr . $prfx); } } }
function xsellLoadProducts(catid,pid) { if (catid) { $('xsell_prod_select').innerHTML='loading...'; new ajax('includes/modules/prod_list.php?cat='+catid+(pid?'&models='+pid:''),{update:'xsell_prod_select'}); } else $('xsell_prod_select').innerHTML=''; } function prodSelected(pid,pdesc,img,catid,ms) { if (!ms) xsellLoadProducts(catid,pid); else if (pid) xSellAdd(pid,pdesc,$('xsellchannel').value,img); } </script> <table><tr><td style="padding:20px 5 5px 0"><img src="/admin/images/add.png"></td><td style="font:bold 13px arial; padding:20px 0 0 0">Add Cross-sell Product</td></tr></table> <table width="100%" cellpadding="5" style="background-color:#B8DB95; border:1px dashed #333"> <tr><td> <?php $catPullDown = array(array('id' => '', 'text' => '-Category-'), array('id' => '0', 'text' => '[Root]')); tep_build_cat_pull_down($catPullDown, '» '); ?> Channel: <?php echo tep_draw_pull_down_menu('xsellchannel', $xsellPullDown, '', 'id="xsellchannel"'); ?> Product: <?php echo tep_draw_pull_down_menu('xsellcat', $catPullDown, '', 'onChange="xsellLoadProducts(this.value)"'); ?> <span id="xsell_prod_select"></span> </td></tr> </table>