However, I came across an issue when I had two categories with the same name, but belonging to different parents. For example, here are two separate paths:
Main > Health > Reproductive Health > Birth Control
Main > Society > People > Women > Health
I could not get the links to show under the Birth Control category because it (within the index function) was assuming the parent id of Birth Control was Health category from the second path... which has no children.
Well, I fixed it. Within that admin function is a catch from all of the categories. If it finds the name from the parent it just assumes that is the parent. I altered it so that it would be added to an array of possible parents. I then looped over all of the possible parents and threw in an "OR" catch on the SQL query.
so now, that piece of the index function (on my implementation) looks like this:
- Code: Select all
$parent_results = mysql_query("SELECT `id`, `path` FROM `categories`");
echo mysql_error();
$parent_id = "";
if(mysql_num_rows($parent_results)){
while($parent_row = mysql_fetch_array($parent_results)){
if($parent_row['path'] == $sub_path){
$parent_id = $parent_row['id'];
$possible_parents[] = $parent_row['id'];
}
}
}
if (count($possible_parents) > 0) {
foreach ($possible_parents as $pid) {
$parent_sql .= " `parent` = '$pid' OR ";
}
$length = strlen($parent_sql);
$new = substr($parent_sql, 0, ($length - 3));
$sql_add = " AND ($new)";
}
$sql = "SELECT `title`, `description`, `keywords`, `id` FROM `categories` WHERE `path` = '$path' $sql_add LIMIT 1";
$relusts = mysql_query($sql);
Hopefully this will help someone else too... or get into the next release.
- Jeff

but it's empty ,