Hi all am still stuck on this one, ive manage to extract all the subcategories for every category but i need to know how to just extract the sub cats for a set category. this is the code i have that extracts all the shop sub cats.
Code:
<?php
if (CATEGORIES_TABS_STATUS == '0')
{
echo '<ul>';
$categories_tab_query = "SELECT c.categories_id, cd.categories_name FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id=cd.categories_id AND c.parent_id= '0' AND cd.language_id='" . (int)$_SESSION['languages_id'] . "' AND c.categories_status='1' ORDER BY c.sort_order, cd.categories_name;";
$categories_tab = $db->Execute($categories_tab_query);
while (!$categories_tab->EOF)
{
$subcategories_tab_query="SELECT c.categories_id, cd.categories_name FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id=cd.categories_id AND c.parent_id= '".(int)$categories_tab->fields['categories_id']."' AND cd.language_id='" . (int)$_SESSION['languages_id'] . "' AND c.categories_status='1' ORDER BY c.sort_order, cd.categories_name;";
$subcategories_tab=$db->Execute($subcategories_tab_query);
if($subcategories_tab->RecordCount()>0)
{
echo '<ul>';
while (!$subcategories_tab->EOF)
{
$cPath_new=zen_get_path($subcategories_tab->fields['categories_id']);
$cPath_new=str_replace('=0_', '=', $cPath_new);
echo '<li>'.'<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">'.$subcategories_tab->fields['categories_name'].'</a></li><br />';
$subcategories_tab->MoveNext();
}
echo '</ul>';
}
echo '</li>';
$categories_tab->MoveNext();
}
echo '</ul>';
}
?>
what part of that code would i change if i wanted to just extract the subcategories for one of my categories (category id 31)
It must be possible to change that code so it only shows the sub cats for my category with the id of 31.
Please can someone help
thanks