OK. Thought about this a little more and rather than move through the cart I have implemented a foreach instead, like this;
<?php
$temp = array();
foreach($theCart->Items as $cart)
{
if(isset($temp[$cart->ID]))
{
$temp[$cart->ID]=$temp[$cart->ID]+$cart->Quantity;
$_SESSION['item_'.$temp[$id]] = $temp[$productID];
}
else
{
$temp[$cart->ID]=$cart->Quantity;
}
}
?>
Now it only returns unique pairs // for ID - Quantity
Just in case someone else might like to us this