there is no need to cycle through the cart to get an items quantity. you can use the eCart GetInfo function
for example, to return the quantity for item ID 1001, use:
$yourCartName->GetInfo("1001", "Quantity");
where yourCartName is the name of the eCart object
you could loop through your array using this code:
<?php
$return = "";
$sausage_ids = array("1001","1002","1003","1004");
foreach($sausage_ids as $k => $v) {
if($yourCartName->InCart($v)) $return .= "the quantity of item ".$v." is ".$yourCartName->GetInfo($v, "Quantity")."<br />";
}
echo $return;
?>