Jump to content

Need to make a change to a parent/child category function


jojomart

Recommended Posts

I hope someone can help me with this

 

I am using a directory script, but the category pull down menu in admin is not what I want. All it does is list the parent, and the child of the parent, not the child of the child. It makes it hard to find the subsubs easily this way. Some of my categories have 4 levels, but all it shows is:

 

Parent

child

child

child

 

with no indentation for the different subcategories.

 

Here's what I really want

 

Parent

- child

-- child of child

--- child of child of child

 

Here is the code:

#catRSelEditPage -- Recursive category select that stops when id is found
/* int $idF, mysql query result $fatherR, mysql connecion $myconn */
function catRSelEditPage($idF,$fatherR,$myconn){
   while($father = mysql_fetch_assoc($fatherR)){    
         if($father['id'] == $idF)
            $selected = ' selected ';
         if($father['fatherID'] == 0)
            print '<option value="'.$father['id'].'"'.$selected.'>*'.$father['title'].'</option>';
         else
            print '<option value="'.$father['id'].'"'.$selected.'>   '.$father['title'].'</option>';      
         $selected = '';
         $sql = "select * from categories where fatherID = '" . $father['id'] . "'";
         $R = mysql_query($sql,$myconn) or die(mysql_error());
         catRSelEditPage($idF,$R,$myconn);
   }//end while
}//end function 

 

Is there anyone out there who can help me, please?

 

Thanks,

Joanne

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.