Search results can contain products from different categories...
You can try creating a Smarty modifier for the purpose and further use it like this: {$product.productid|get_parent_category} in the templates.
To create a new Smarty modifier plugin create the "include/templater/plugins/modifier.get_product_parent_category.php" script with the following content:
PHP Code:
<?php
if (!defined('XCART_START')) { header("Location: ../../../"); die("Access denied"); }
function smarty_modifier_get_product_parent_category($productid) {
global $sql_tbl;
// main product category id
return func_query_first_cell("SELECT categoryid FROM $sql_tbl[products_categories] WHERE main='Y' AND productid='$productid'");
}
?>