Thanks cflsystems but I realised this would only work if the main category of the product to be hidden was 273.
A better way I found (for anyone else who finds this thread) is to flush out the products after the database query has been completed. Like this:
PHP Code:
// collect productids of products from categoryid 273 to flush from search results
if ($cat == "") { // only if this is a search result, not a category page
$get_products=mysql_query("SELECT productid FROM xcart_products_categories WHERE categoryid='273'");
while ($row_products = mysql_fetch_array($get_products)) {
$products_arr[]=$row_products['productid'];
}
foreach ($products as $k => $v) {
if (in_array($products[$k]['productid'], $products_arr)) {
unset($products[$k]);
$total_items=$total_items-1;
}
}
}