If you're looking to reset the current customer's quote to a blank quote (e.g. to 'save' their cart for later) the following should suffice (untested code):
To change the current quote:
$quote_id = /*your quote id here*/ ;
Mage::getSingleton('checkout/session')->setQuoteId($quote_id);
To get rid of the current quote altogether:
Mage::getSingleton('checkout/session')->setQuoteId(null);
Edit
If you want to forcefully reattach a customer's quote to another customer, you can change the customer_id
of the sales_flat_quote
field:
For registered customers:
$quote->setCustomerId($customer_id);
For guests:
$quote->setCustomerId(null)
->setCustomerEmail($email)
->setCustomerFirstname($firstname)
->setCustomerLastname($lastname)
->save();
$quote_id = $quote->getId();
Mage::getSingleton('checkout/session')->setQuoteId($quote_id);
customer_id
? Having different IDs would solve your problem perfectly, then you just change the customer in the session: magento.stackexchange.com/questions/1161/…