allright Posted January 22, 2009 Share Posted January 22, 2009 Hi all, I have $current_category_id now, how can I extract its sub categories' ID ? Your kind hint is greatly appreciated, thank you. Best regards, allright Link to comment Share on other sites More sharing options...
roya.k Posted January 22, 2009 Share Posted January 22, 2009 <?php $sub_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id."'"); while ($sub_categories = tep_db_fetch_array($sub_categories_query)) { echo $sub_categories['categories_id']; /// or what you want } ?> Open source n'est pas un échange à sens unique ... La plupart du temps un simple merci ou quelques mots d'encouragement suffisent... Link to comment Share on other sites More sharing options...
roya.k Posted January 22, 2009 Share Posted January 22, 2009 another solution, more elegant: <?php $arr= tep_get_categories('', (int)$current_category_id); for ($i=0; $i<sizeof($arr); $i++) { echo $arr[$i]['id']; /// or what you want } ?> Open source n'est pas un échange à sens unique ... La plupart du temps un simple merci ou quelques mots d'encouragement suffisent... Link to comment Share on other sites More sharing options...
burt Posted January 22, 2009 Share Posted January 22, 2009 Should think before I post ;) As above - my way would only work the other way, using previous. Ignore. Use as above. Link to comment Share on other sites More sharing options...
ydhcxh Posted January 22, 2009 Share Posted January 22, 2009 Very good Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.