I wanted to indicate which products are already in the cart by adding a border to the image, so at the top of com_virtuemart/category/default.php
I added:
$array = unserialize($_SESSION['__vm']['vmcart']);
$totalHaxProducts=array();
foreach($array->products as $product){
array_push($totalHaxProducts,$product->virtuemart_product_id);
}
and then at the part where the product images are displayed:
<?
if(in_array($product->virtuemart_product_id,$totalHaxProducts)){
echo "style=\"border:3px solid #ff0000;\"";
}
?> />
hope that helps someone.