The easiest method is to use a function ...

Oh lookie a handy dandy function built into Zen Cart ...

PHP Code:
echo zen_get_categories_name_from_product($product_id); 
Where $products_id would be the Product products_id based on where you are when you use it ...

On the shopping_cart that would be:
$products[$i]['id']

PHP Code:
echo zen_get_categories_name_from_product($products[$i]['id']); 
Now just stick that somewhere nice in the code ...