[eluser]Tominator[/eluser]
It's impossible to 'solve'.
For each category, there are another data of products in PHP. But you are making array ($data) in loop, that's why it's replacing, and after cycle you have data only from last loop in final array. Than you pass this array to Parser ...
Solution is in making specific arrays by adding some dynamic infomation like ID