You can get the parent category pretty simple: It’s assigned to the object.
$cat = get_category( $q_cat );
// Get the ID
echo $cat->category_parent;
You can get the parent category pretty simple: It’s assigned to the object.
$cat = get_category( $q_cat );
// Get the ID
echo $cat->category_parent;