I've been trying without success to obtain the line level information about a specific order but i am getting the header information.
Take a look at this picture:
This is my query:
select o.increment_id, o.status, oi.price_incl_tax, t.carrier_code, o.created_at, oi.price_pvp, oi.created_at, o.shipping_instruction, o.payment_term
from sales_flat_order o
join sales_flat_order_item oi
on o.entity_id = oi.order_id
left join sales_flat_shipment_track t
on o.entity_id = t.order_id
where oi.parent_item_id is null
What's wrong? Can you please help me to solve this?
EDIT:
This is what i found in MYSQL:
The problem here is that i do not understand how should i look into this in order to obtain what i need :/.
shipping_instruction
,payment_term
are not fields of standard Magento in thesales_flat_order
table. Therefore you should look into your customization if you would expect data in that fields - the SQL returns NULL because there is no data in that fields for the orders you have selected. Regarding thecarrier_code
: The tracking data is usually assigned to an order when something has been shipped, which might not be the case in your statuswaiting_approval
(which again is not standard Magento but some customization). IMHO the SQL is correct and returns the data you have in database.sales_flat_order_item
table) in your SQL joined to the order head (sales_flat_order
table) data. For example the SKU comes from there. So I don't really understand what your problem is - it's not clear what you are looking for and what is not working. Again, your SQL is correct and returns oder lines joined to order head data.