I used 2 tables for solving this problem in past. Table pair gives unlimited categories or not categories at all. This is same as directory structure in your computer.
1) product_master (prod_id, prod_name, is_group, other_columns)
2) product_level (child_prod_id, parent_prod_id, level_no)
product_master
prod_id, prod_name, is_group, other_columns
0, Items, Y, XYZ (This is root group)
1, Pen, Y, xyz1 (This is sub group)
2, Black pen, N, PQR (This is first item of first group)
3, Red Pen, N, QBC (This is second item of first group)
4, HB Pencil, N, NCR (This is direct item under primary "Items" group)
Product_level (This is to keep track of categories and items properly)
child_prod_id, parent_prod_id, level_no
0,0,0 (root under self at level 0)
1,1,0 (first group under itself at level 0)
1,0,1 (first gropu under items at level 1
2,2,0 (first item under itself at level 0)
2,1,1 (first item under first gropu at level 1)
2,0,2 (first item under "items" at level 2)
3,3,0 (second item under itself at level 0)
3,1,1 (second item under first gropu at level 1)
3,0,2 (second item under "items" at level 2)
4,4,0 (third item under "items" at level 2)
4,0,1 (third item under "items" at level 1)