Authored by 周少峰

分类和其他搜索条件分离

... ... @@ -16,7 +16,6 @@ class HelperSearch
public static $options = array();
//当前页
public static $page = 1;
public static $siteDomain = '.yohobuy.com';
/**
* 选中的条件
... ... @@ -223,6 +222,9 @@ class HelperSearch
}
$params = self::$params;
$gender = isset($params['gender']) ? $params['gender'] : '';
if (isset($params['gender'])) {
unset($params['gender']);
}
//设置选中
if ($gender == '1,3' || $gender == '2,3') {
self::$selected['gender'] = array(
... ... @@ -230,9 +232,7 @@ class HelperSearch
'href' => self::buildUrl($params)
);
}
if (isset($params['gender'])) {
unset($params['gender']);
}
if (self::checkSearch('gender')) {
return array();
}
... ... @@ -317,22 +317,15 @@ class HelperSearch
foreach ($sort as $key => $val) {
$result[$key]['id'] = $val['sort_id'];
$result[$key]['name'] = $val['sort_name'];
if (isset($params['msort']) && $params['msort'] == $val['sort_id']) {
unset($params['msort']);
self::$selected['sort'] = array(
'name' => $val['sort_name'],
'href' => self::buildUrl($params)
);
}
if (isset($val['sub']) && !empty($val['sub'])) {
foreach ($val['sub'] as $k => $v) {
$result[$key]['sub'][$k]['href'] = self::buildUrl(array_merge($params, array('msort' => $val['sort_id'], 'misort' => $v['sort_id'])));
$result[$key]['sub'][$k]['href'] = self::buildUrl(array('msort' => $val['sort_id'], 'misort' => $v['sort_id']));
$result[$key]['sub'][$k]['name'] = $v['sort_name'];
if (isset($params['misort']) && $params['misort'] == $v['sort_id']) {
unset($params['misort']);
self::$selected['sort'] = array(
'name' => $v['sort_name'],
'href' => self::buildUrl($params)
'href' => self::buildUrl()
);
}
... ... @@ -424,10 +417,6 @@ class HelperSearch
'href' => self::buildUrl($params)
);
}
//搜索页已选中,返回空
if (self::checkSearch('brand')) {
return array();
}
ksort($brandList);
//品牌列表排序, 添加品牌索引
$index_key = array();
... ... @@ -446,6 +435,10 @@ class HelperSearch
}
unset($brandList);
}
//搜索页已选中,返回空
if (self::checkSearch('brand')) {
return array();
}
return $result;
}
/**
... ... @@ -470,9 +463,7 @@ class HelperSearch
'href' => self::buildUrl($params)
);
}
if (self::checkSearch('size')) {
return array();
}
$result[] = array(
'name' => $v['size_name'],
'href' => self::buildUrl(array_merge($params, array(
... ... @@ -480,6 +471,9 @@ class HelperSearch
))) ,
);
}
if (self::checkSearch('size')) {
return array();
}
}
return $result;
}
... ... @@ -1061,6 +1055,7 @@ class HelperSearch
*/
public static function shop($shop)
{
$url = Helpers::url('','',$shop['brand_domain']);
$shopEntry = array();
$sort = array();
foreach ($shop['sort'] as $msort) {
... ... @@ -1071,13 +1066,13 @@ class HelperSearch
if (count($sort) >= 10) {
break 2;
}
$sortInfo['href'] = 'http://' . $shop['brand_domain'] . self::$siteDomain.'/?msort=' . $msort['sort_id'] . '&misort=' . $misort['sort_id'];
$sortInfo['href'] = $url.'/?msort=' . $msort['sort_id'] . '&misort=' . $misort['sort_id'];
$sortInfo['name'] = $misort['sort_name'];
$sort[] = $sortInfo;
}
}
$shopEntry['home'] = $shop['brand_domain'].'yohobuy.com';
$shopEntry['home'] = $url;
$shopEntry['logo'] = Images::getSourceUrl($shop['brand_ico'],'brandLogo');
$shopEntry['shopName'] = $shop['brand_name'];
$shopEntry['sort'] = $sort;
... ...