Need help on writing a LOOP

  • I need some help on a loop and I can not work it out. I have been stuck on this bit for sometime. I posted on another forum see link Here . I have not had much luck and now I have posted here, hoping someone can help.


    PROBLEM

    Currently the code is not looping through all the products, it can take off the first, with child elements (THIS IS IMPORTANT). However it only does the first item over and over again.



    My latest code is here or visit the above link for more information