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?
Best Answer
Yes they both are same. Magento saves order in
sales_order
table and products of order are stored insales_order_item
andorder_id
insales_order_item
table connects that product to its order fromsales_order
table havingentity_id
same asorder_id
.