Authored by 周少峰

搜索页分类显示, 列表页左侧分类仅保留性别

... ... @@ -83,7 +83,7 @@ class HelperSearch
//分类条件(搜索页面)
if (isset($data['sort']['sort'])) {
//分类条件(搜索页面)
if (isset($options['controller']) && $options['controller'] != 'Search') {
if (isset($options['controller']) && $options['controller'] == 'Search') {
$result['filters']['sort'] = self::searchSort($data['sort']['sort']);
}else{
//左侧分类分类
... ... @@ -283,6 +283,10 @@ class HelperSearch
//设置导航
self::setListNav($options);
$params = self::$params;
$gender = array();
if (isset($params['gender']) && !empty($params['gender'])) {
$gender['gender'] = $params['gender'];
}
$result = array(
'all' => array(
'name' => '全部品类',
... ... @@ -293,7 +297,7 @@ class HelperSearch
);
$sortList = array();
foreach ($sort as $key => $val) {
//若参数有分类,设置导航
//若url参数有分类,设置导航
if (isset($params['msort']) && $params['msort'] == $val['sort_id']) {
//是否有品牌
$navIndex = isset($option['brandName']) && $option['brandName'] ? 2 : 1;
... ... @@ -310,12 +314,12 @@ class HelperSearch
$sortList[$key]['active'] = isset(self::$params['msort']) && self::$params['msort'] == $val['sort_id'] ? true : false;
$sortList[$key]['childList'][] = array(
'name' => '全部分类',
'href' => self::buildUrl(array_merge($params, array('msort'=>$val['sort_id'])))
'href' => self::buildUrl(array_merge($gender, array('msort'=>$val['sort_id'])))
);
if (isset($val['sub']) && !empty($val['sub'])) {
foreach ($val['sub'] as $k => $v) {
$sortList[$key]['childList'][$k+1]['name'] = $v['sort_name'];
$sortList[$key]['childList'][$k+1]['href'] = self::buildUrl(array_merge($params, array('msort' => $val['sort_id'], 'misort' => $v['sort_id'])));
$sortList[$key]['childList'][$k+1]['href'] = self::buildUrl(array_merge($gender, array('msort' => $val['sort_id'], 'misort' => $v['sort_id'])));
$sortList[$key]['childList'][$k+1]['childActive'] = isset(self::$params['misort']) && self::$params['misort'] == $v['sort_id'] ? true : false;
}
}
... ...