Ideally we need the OrderID number in the email generated on the confirm.php page and on the checkout_success.php page to act as an invoice number (that's unless you suggest a better way to create an invoice number).
I've attached these two UE files but I'm not sure if this is the best way to put code into a UE template. I think I should be using the UE in DW display and inserting an ecart binding?
Also I understand when you say one of these originator pages could be closing the session. How do I get around that?