Magento – Checkout: remove item from quote but keep in cart

cartonepage-checkoutquote

I want to remove certain items when customer place an order but keep them in cart.
I'm able to remove the item by override the saveOrder() method in checkout/type_onepage model, but the items are also removed from the cart. Any pointer as to how to keep the items in the cart? Thanks

Best Answer

In the Mage_Checkout_OnepageController::successAction there is this line:

$session->clear();

where

$session = $this->getOnepage()->getCheckout();

This clears the cart completely.
But I wouldn't interfere with this process.
When you submit an order the quote associated to the order is inactivated and a link is made between the order and the quote.
I would leave this as it is and instead remember the products that you removed from the order and use this event checkout_quote_destroy (or an other one, but this is the first that came in mind), to recreate a new quote object for the current session where you add the products that were not included in the order.
[EDIT]
or you can use this event checkout_type_onepage_save_order_after but I'm not 100% sure about it.