Need PHP JSON Help With a Function That Combines 4 tables into one Product Object/Array

Job ID: 34307517

Budget: $8 – $15 USD

Hi there. I have an E-Commerce project and I need help combining 4 mysql tables into a function that outputs all the products (we actually already have a function made, but it's not fully working).

I'm attaching an example of the API function's output which we are trying to re-create (and base this function on) - basically, we import the product data, so we can list the products from our local mysql database which is way faster than pulling the products from the API.

The API example in my screenshot has lots more data than we actually need for the local version, so in the attached screenshot - just look at the "variations" part of it - that's what I need to add - and like I said I already have a function that works, but it's missing that part. I can give you access to it (VPS, PHP, MySQL).

My Tables:
Products
Variations
Modifier Lists
Modifiers

Example:
Product: Coffee
Variations: Large - $4.50 | Medium - $3.50 | Small - $2.50
Modifier Lists: Milk/Cream, Flavor, Sweetener
Modifiers:
Milk/Cream: 2%, Whole, Skim, Coconut Milk
Flavor: Vanilla, Hazelnut, Mocha
Sweetener: Sugar, Coconut Sugar, Sweetener

That structure makes up a product. Right now the Modifiers and Variations aren't outputting, but I'm more concerned with fixing the Variations first - then we can fix the Modifiers after.
Related categories: PHP JavaScript AJAX Software Architecture MySQL