I want an sql query which returns a list of distinct products according to a parent category id. My search will be recusrively, finding the leaf (products) of my category structure.
Example: we have the following category structure.
If I search by Category 2's id, then I want not only its 2 products, but recursively all child-leafs products (15 products).
Category 1
Category 2 (2 products)
Category 2.1 (5 products)
Category 2.1.1 (2 products)
Category 2.1.2 (2 products)
Category 2.2 (4 products)
Category 2.3 (0 products)
Category 3
Dows Virtuemart has such a function. Can someone help me with this?