WordPress custom post categories and subcategories on category.php

Thanks to all! Here is my solution which worknig well

<?php 

$cat = get_query_var('cat');

$categories = get_categories('parent=".$cat."'); 

if(isset($categories) && !empty($categories)){ 

    foreach ($categories as $category) { ?>

        <span class="subhead-title"><?php echo $category->name; ?></span>

        <?php $prods = new WP_query(); $prods->query('post_type=products&cat=" . $category->cat_ID . "'); ?>
            <?php if($prods->have_posts()) { ?> <ul class="cat-arc-links"> <?php while ($prods->have_posts()) { $prods->the_post(); ?>

                 <li><a href="https://wordpress.stackexchange.com/questions/251890/<?php the_permalink(); ?>" class="product-link"><?php the_title(); ?></a></li>


             <?php } ?> </ul> <?php } ?>

<?php }

}
else 
{
    global $query_string; // basic query parameters
    query_posts( $query_string.'&post_type=products'); // basic query + self parameters 

    if( have_posts() ) { ?> <ul class="cat-arc-links"> <?php  while( have_posts() ){ the_post(); ?>

            <li><a href="https://wordpress.stackexchange.com/questions/251890/<?php the_permalink(); ?>" class="product-link"><?php the_title(); ?></a></li>

<?php } /* end of while */  wp_reset_query(); ?>
</ul>
    <div class="navigation">
        <div class="next-posts"><?php next_posts_link(); ?></div>
        <div class="prev-posts"><?php previous_posts_link(); ?></div>
    </div>

<?php
    } 
    else 
        echo "<h2>No entries.</h2>";
}
?>