I am creating a module that is going to save orders to a .csv file. The problem now is that I need both the name of the product and the name of the customer. As far as I know these are not stored in the same mysql table. I can get the customer name form the "sales_order" table and the product name form the "sales_order_item". "sales_order" has an id called "entity_id" and "sales_order_item" has an id called "order_id". Are these ids the same?

Or is there a better way of doing this?

1 Answer 1


Yes they both are same. Magento saves order in sales_order table and products of order are stored in sales_order_item and order_id in sales_order_item table connects that product to its order from sales_order table having entity_id same as order_id .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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