2

Foreach customer, I need to retrieve every order. Foreach order, I need to retrieve each product item.

The tables are sales_order and sale_order_Item, but I don't see a connection. How are these mapped to each other?

In a nutshell, I am trying to create an array of every invoice with its related data.

invoices = [
"Name" => "John Doe",
"Items Invoiced" => [
                     "Product" => 'Maple Wood Table',
                     "Price" => 999.99,
                     "QTY" => 1
                     "Row Total" => 1074.33
                     ],
"Billing Address => [...],
"Account Information" => [...]
],
invoices = [
"Name" => "Jane Doe",
"Items Invoiced" => [
                     "Product" => 'Red Oak Table',
                     "Price" => 1299.99,
                     "QTY" => 1
                     "Row Total" => 1434.25
                     ],
"Billing Address => [...],
"Account Information" => [...]
],

//And so on for every invoice in the database

1 Answer 1

0

sales_order_item is connected to sales_order via the "order_id" column in the item table which links to the "entity_id" column in the order tableenter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.