Firgured this out myself. Damn Im on a roll today!
Create a new page called 'sub_cat_fields_array.php' in modules/Sub_Cats
Code:
<?php
if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); }
if($products) {
foreach($products as $product) {
$productid = $product['productid'];
$sub_cats[$productid] = func_query("SELECT $sql_tbl[products_categories].* FROM $sql_tbl[products_categories] WHERE ($sql_tbl[products_categories].productid = '$productid') AND $sql_tbl[products_categories].main='N'");
}
}
$smarty->assign("sub_cats",$sub_cats);
?>
Then include the file in products.php
Code:
include $xcart_dir."/modules/Sub_Cats/sub_cat_fields_array.php";
Then in your products.tpl you can view the items subcats.
Code:
{assign var="subtcat" value=$sub_cats[$pid][0].categoryid}
This is for a product with one subcat. If your product has more then you need to loop through this.