ok so im playing with both of these to see which i can get working and which works best.

Webomat thanks so much for the help, i have one question though. im not to experienced with php i have learned alot and learning more every day i assume i know when the function ends but i keep getting errors. so this leads me to think i have no clue*L*
here is a small part of the code i just want to make sure im doing it right

is the area in red the function i need to duplicate? or am i totally off.
could you tell me exactly what starts and ends this function also where do i place it after copying it? right after the original function i assume.
i understand the rest of how to do this im just confused about where the function starts and ends.

Code:
class category_tree extends base {
  function zen_category_tree($product_type = "all")   {
   global $db, $cPath, $cPath_array;
   if ($product_type != 'all') {   
      $sql = "select type_master_type from " . TABLE_PRODUCT_TYPES . "
                where type_master_type = " . $product_type . "";
      $master_type_result = $db->Execute($sql);
      $master_type = $master_type_result->fields['type_master_type'];
 
    }    
 
    $this->tree = array();
    if ($product_type == 'all') {
      $categories_query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image
                             from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
                             where c.parent_id = 0  
                             and c.categories_id = cd.categories_id
                             and cd.language_id='" . (int)$_SESSION['languages_id'] . "'
                             and c.categories_status= 1
                             order by sort_order, cd.categories_name";
    } else {
      $categories_query = "select ptc.category_id as categories_id, cd.categories_name, c.parent_id, c.categories_image
                             from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " ptc
                             where c.parent_id = 0  
                             and ptc.category_id = cd.categories_id
                             and ptc.product_type_id = " . $master_type . "
                             and c.categories_id = ptc.category_id
                             and cd.language_id=" . (int)$_SESSION['languages_id'] ."
                             and c.categories_status= 1
                             order by sort_order, cd.categories_name";
    }
thanks so much for your help