Same principle applies:
- You are looping through all products to generate first div.
- Now take same list of products and generate list of posts for it in second div.
- Count how many products you have and generate that many classes in your JS code.
Same principle applies: