I am looking to export order information for all the orders from a magento system i want to migrate from. These are the fields I require
Order_id, sku, item_quantity, item_price, order_total_amount, Created_at, Billing_address, Billing_city, billing_state, billing_country, billing_zipcode, billing_customer_name, billing_customer_mobile, billing_customer_email, shipping_address, shipping_city, Shipping_state, shipping_zipcode, Shipping_country, shipping_charge, shipping_customer_name, shipping_customer_mobile, order_status
I have tried a few free extensions but they do not solve my purpose.
It would be helpful if you can help me write a SQL to export the data out.
I already have a SQL. Could you help me refine this to get the details i need
SELECT sfo.entity_id, sfo.status, sfo.customer_email, oi.product_id, oi.name,
oi.price, sfo.total_due, billing.firstname, billing.lastname, billing.street,
billing.city, billing.postcode, billing.country_id, billing.telephone, shipping.firstname,
shipping.lastname, shipping.street, shipping.city, shipping.postcode, shipping.country_id,
shipping.telephone, sfo.store_name, sfo.store_currency_code, sfo.created_at
FROM sales_flat_order AS sfo
JOIN sales_flat_order_address AS billing ON billing.parent_id=sfo.entity_id AND billing.address_type='billing'
JOIN sales_flat_order_address AS shipping ON shipping.parent_id=sfo.entity_id AND shipping.address_type='shipping'
JOIN sales_flat_order_item as oi ON oi.order_id=sfo.entity_id
I also need to handle the case where one order can include multiple items.
order collection
: CallMage::getModel('sales/order')->getCollection();
and iterate it in a foreach-loop to get the single object property for each order. – Ivansales_flat_order
,sales_flat_invoice
, andsales_flat_invoice_item
. I go on a bit in my answer here: magento.stackexchange.com/questions/40084/… – Abirritate