define("CURSCRIPT", "goods"); include_once './common.php'; $active['goods'] = ' class="active"'; $tagarrs = $goodlist = $where = $value = array(); $tagids = $joinsql = $wheresql = ''; $query = NULL; //常見id處理 foreach (array('itemid', 'nid', 'uid', 'catid', 'tagid', 'shopid') as $value) { $_GET[$value] = $_POST[$value] = intval(!empty($_POST[$value]) ? $_POST[$value] : $_GET[$value]); } $_GET['keyword'] = trim(addslashes(rawurldecode($_REQUEST['keyword']))); $catid = empty($_GET['catid']) ? 0 : $_GET['catid']; $categorylist = getmodelcategory('good'); //讀商品分類 include_once './batch.attribute.php'; $searchcats = getsearchcats($categorylist, $catid); $tagid[] = $catid; if (is_array($searchcats)) { foreach ($searchcats as $key => $value) { $tagid[] = $value['catid']; } } $tagids = implode(',', $tagid); //搜索分類id拼合 //屬性篩選器 $attrvalues = empty($_GET['params']) ? array() : getattrvalues($_GET['params']); if ($catid && $categorylist[$catid]['havechild'] == 0) { $attform = formatattrs($catid, $attrvalues, $_GET['keyword']); } //屬性搜索 $attr_in = getattr_in($catid, $attrvalues);
/** * 統計分類下結果數之和 * @param $catid - 分類id * @param $catnums - 分類結果數 * @return $catnums */ function getcatcount($catid = 0, $catnums) { global $_G, $categorylist; $catid = intval($catid); $_cats = getsearchcats($categorylist, $catid); if (is_array($_cats)) { foreach ($_cats as $k => $vv) { $catnums[$catid] += $catnums[$vv['catid']]; } } return $catnums; }