3
votes

I am new to Magento.

I would like to export following data from order tables in CSV format. In my sample database I do not have records for Shipment Tracking number, so do not know in which table it is stored

Please give some suggestions.

Data to export are

  1. Order Number
  2. Shipping Address
  3. Shipping City
  4. Shipping State
  5. Shipping Zip
  6. Phone Number
  7. Tracking Number
1

1 Answers

2
votes

You could try this free extension which exports rather more than you need but any spreadsheet can easily remove columns afterwards.

If you prefer to work directly with the database then you might use something like this:

SELECT orders.increment_id, address.street, address.city, address.region,
       address.postcode, address.telephone, track.track_number
-- prior to 1.6 `track_number` should be `number`
FROM sales_flat_order AS orders
JOIN sales_flat_order_address AS address ON address.parent_id = orders.entity_id
JOIN sales_flat_shipment_track AS track ON track.order_id = orders.entity_id
WHERE address.address_type = 'shipping'