function get_top_cat_id($nid) { $sql = "select parent_id from " . $GLOBALS['ecs']->table('category') . " where cat_id = " . $nid . ""; $temp_id = 0; $pid = $GLOBALS['db']->getOne($sql); if ($pid > 0) { $temp_id = get_top_cat_id($pid); } else { $temp_id = $nid; } return $temp_id; }
$position = assign_ur_here($cat_id, $brand_name); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree($cat_id)); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('show_marketprice', $_CFG['show_marketprice']); $smarty->assign('category', $cat_id); $smarty->assign('p_id', get_parent_cat_id($cat_id)); //888 $smarty->assign('top_id', get_top_cat_id($cat_id)); //888 $smarty->assign('brand_id', $brand); $smarty->assign('price_max', $price_max); $smarty->assign('price_min', $price_min); $smarty->assign('filter_attr', $filter_attr_str); $smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? "feed-c{$cat_id}.xml" : 'feed.php?cat=' . $cat_id); // RSS URL if ($brand > 0) { $arr['all'] = array('brand_id' => 0, 'brand_name' => $GLOBALS['_LANG']['all_goods'], 'brand_logo' => '', 'goods_num' => '', 'url' => build_uri('category', array('cid' => $cat_id), $cat['cat_name'])); } else { $arr = array(); } $brand_list = array_merge($arr, get_brands($cat_id, 'category')); $smarty->assign('data_dir', DATA_DIR); $smarty->assign('brand_list', $brand_list);