SELECT count(a.product_id) AS number_of_products,a.category_id FROM #__hikashop_product_category AS a INNER JOIN #__hikashop_product AS b ON a.product_id=b.product_id AND b.product_published>0 WHERE a.category_id IN (29,30,31,32,33,35,46,47) GROUP BY a.category_id
Here is the result in mysql:
number_of_products category_id
6 29
2 30
2 32
1 33
15 35
1 46
4 47
I debugged the file components/com_hikashop/views/category/view.html.php line #183 - #187
Note: in the id's, #47 is a sub category of #35 and results are fine but #31 has two sub categories (#38 & #39) and the results are going wrong (0)