I have an old Magento database file, but the files associated with it are gone.

The database file is for Magento 7.02

I need to export the orders with the line items and a description of the item from the database.

Does anyone have a way that I can get this data from the database extract, without having the original files for Magento itself?

Fields: Order - Order ID, Customer Name, Email, Order Date, Amount

OrderContents - OrderId, LineItem, Name, Description, Cost

Anyone have a good idea to extract the data?


2 Answers 2


The involved tables are:

  • sales_flat_order - for base order data such as Order ID, date and total amounts;
  • sales_flat_order_address - to retrieve customer data (unless the order is related to a virtual/downloadable product, there are two rows per order, respectively the billing and the shipping address);
  • sales_flat_order_item - to retrieve order contents; the number of rows (items) depends on the product types; pay attention to the items with a not null parent_item_id value which means that a particular product type (such as a configurable) was ordered; for the type of data you want to retrieve you should find it in parent item rather than in child one;

There are other tables related to the order that contain data you don't seem to need:

  • sales_flat_order_payment
  • sales_flat_order_status_history
  • sales_order_tax
  • sales_order_tax_item
  • sales_payment_transaction

Hope it helps.


Not sure why you do not want magento files. i would recommend following apporach

1) Take fresh Magento of the same version as the database.

2) Change setting in local.xml with the database you have

3) install this module


Which would export all the order in csv format and you can use the same format to import into newer version.

Hope this will help

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.