Question

Steps to reproduce:

  1. Click Edit on first order, i.e 000000001
  2. Click Edit on second order, i.e 000000002
  3. Click Add Products on first order edit screen
  4. Select any product and click Add Selected Product(s) to Order

You'll now see that the contents of 000000001 are all of the product(s) from 000000002 - as well as the product you selected.

I've also noticed some strange behavior when it comes to placing the orders after editing them whereby for instance the editing of 000000002 will result in it's new increment id being 000000001-1.

I think this bug may stem from the adminhtml/session_quote object (app/code/core/Mage/Adminhtml/Model/Session/Quote.php). Does this mean that Magento can only handle the editing of a single order per session? Surely it would differentiate between the session objects using the parent entity id or something along those lines?

Edit: The same behavior is experienced when placing two orders simultaneously, which leads me to believe it's definitely related to the inability to split the adminhtml/session_quote objects on a per parent order entity id basis.

Was it helpful?

Solution

I don't think this is a bug. It's rather a limitation on how the admin edit order is implemented.
When you hit Edit on and order (and when you create and order from scratch) in the backend the session is involved. See how the Mage_Adminhtml_Sales_Order_EditController and Mage_Adminhtml_Sales_Order_CreateController classes look like and what they do.

So when you hit edit on the second order, the session is cleared (see Mage_Adminhtml_Sales_Order_EditController::startAction) and you are not editing the first order anymore.

But the form from the first edited order is filled with data from the first order. only the ajax calls you make from this point on in the edit order screen will return values from the second order you edit.
That's why you get mixed results from the first and second order.

When submiting the form from the first order, you are submitting data like customer id or currency from the first order but you got the items from the second order.

The lesson here is to never edit 2 orders within the same session.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top