I'm writing a custom component cart, and using a form post to save cart data in the Joomla session.
It works initially, but then if the user goes back to add another item, the original item is overwritten. The form itself is simply posting from the products view to the cart view, so I'll just show you how it's being retrieved and saved to session:
$cart = array();
$cart['items'][] = array(
'action' => $app->input->get('action', 'add', 'STRING'),
'domain_name' => $app->input->get('chosen_domain', '', 'STRING'),
'chosen_plan' => $app->input->get('chosen_plan', '', 'STRING'),
'chosen_location' => $app->input->get('chosen_location', '', 'STRING'),
'chosen_type' => $app->input->get('chosen_type', '', 'STRING'),
'chosen_id' => $app->input->get('chosen_id', '', 'INT'),
'chosen_period' => $app->input->get('chosen_period', '', 'INT')
);
$session = JFactory::getSession();
$session->set('cart', $cart);
$cart_result = $session->get('cart');
echo "<pre>" . print_r($cart_result, TRUE) . "</pre>";