1、打开goods.php并找到
$smarty->assign('goods', $goods);
在它上面增加以下代码
$cat_arr = get_parent_cats($goods['cat_id']); foreach ($cat_arr AS $val) { $goods['topcat_id']=$val['cat_id']; $goods['topcat_name']=$val['cat_name']; }
2、在goods.dwt文件中既可调用
顶级分类ID:{$goods.topcat_id} 顶级分类Name:{$goods.topcat_name}