How to achive this:

Category 1 (899)

-- Category 1.1 (189)

-- Category 1.2 (700)

----- Category 1.2.1 (300)

----- Category 1.2.2 (400)

I have made some progess. But it onlly counts the number of products in "Subcategories"

This is the code: 

```
$ProductsCount = 0;
    $ProductsCount = (int)Db::getInstance()->getValue('SELECT COUNT(cp.`id_product`) AS total
    FROM `'._DB_PREFIX_.'product` p
    '.Shop::addSqlAssociation('product', 'p').'
    LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
    WHERE cp.`id_category` = '.$id_category.
    ' AND product_shop.`visibility` IN ("both", "catalog")
    AND product_shop.`active` = 1;' );

```

but i get such result:

Category 1 (0)

-- Category 1.1 (0)

-- Category 1.2 (0)

----- Category 1.2.1 (300)

----- Category 1.2.2 (400)

I think this code needs some modification. Or Am i wrong? I fit is more complicated then sorry for posting this here!