Take the 2-minute tour ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

The question might look a bit stupid but I don't understand the difference between parent_id and order_id.

share|improve this question
    
can you point the specific sales order table? –  MTM Jul 25 at 13:45
    
Well obviously order_id is your order id, but I'm not so sure on parent_id, I've never seen a child order –  Julien Lachal Jul 25 at 13:45
    
magentocommerce.com/api/soap/sales/salesOrder/… You can see parent_id at the beginnin and order_id above... order_id is necessary for the invoice... For sure increment_id is the showed order id but the difference between the other you is a mistery for me! –  user3686751 Jul 25 at 13:46
    
I guess the parent id will be in case the order was edited. –  MTM Jul 25 at 13:47
2  
nop, when you edit any order, the previous one is cancelled and a new one is placed, you will find a link to old order in the new one, thats i guess where the parent id is used –  MTM Jul 25 at 13:56

3 Answers 3

up vote 0 down vote accepted

In the order table itself there are two fields:

  1. relation_parent_id - the entity_id of the original order before editing in admin,
  2. relation_parent_real_id - the increment_id of the original order before editing in the admin,

So in these tables relation_parent_id will be the tables auto-increment something like 195 but relation_parent_real_id will be the Magento order increment something like 145000003.

I am not sure why the soap api only talks about 1 but there are two in the table itself.

share|improve this answer

order_id is the table increment id.
parent_id only has a value if you edit the order in the backend.
Here is how it works.

When you edit an order in the backend, the order is canceled and a new order is created, ending up with 2 orders.

In order to keep a link between these 2 orders, magento stores in the parent_id field of the second order the order_id of the original order.
That's why you will see on the second order view page in the backend a link to the original order.

share|improve this answer

Order id is the unique key (primary key) of the order, while the Parent Id is used if the order is edited, the edited order will be cancelled and a new order will be placed, parent id will be then used as a reference to link both. Just as in the image below:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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