Authored by 周少峰

搜索页条件按照已经选择条件显示

... ... @@ -86,7 +86,7 @@ class HelperSearch
$result['filters']['brand'] = self::brand($filter, $options);
//价格
$result['filters']['price'] = self::price($filter);
$result['filter']['customPrice'] = self::customPrice($filter);
$result['filters']['customPrice'] = self::customPrice($filter);
//颜色
$result['filters']['color'] = self::color($filter);
//尺寸
... ... @@ -467,9 +467,10 @@ class HelperSearch
}else{
$price = explode(',', $priceId);
if (count($price) == 2) {
self::$selected['price'] = array(
'name' => self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$price[0] . '-' . (int)$price[1],
'url' => self::buildurl($params)
'href' => self::buildurl($params)
);
}
}
... ... @@ -492,19 +493,18 @@ class HelperSearch
public static function customPrice($filter) {
$params = self::$params;
$result = array(
'customMin' => '',
'customMax' => ''
'min' => '',
'max' => ''
);
$priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
if (isset($params['price']) && !isset($filter['price'][$priceId]) ) {
$price = explode(',', $params['price']);
unset($params['price']);
$result = array(
'customMin' => $price[0],
'customMax' => $price[1]
'min' => $price[0],
'max' => $price[1]
);
}
print_r($result);
return $result;
}
... ...
... ... @@ -60,6 +60,42 @@ class SearchModel
}
/**
* 搜索页面获取搜索数据
* @param $condition
* @param $options
* @return array
*/
public static function searchData($condition, $options){
$data = self::getSearchData($condition, $options);
//过滤频道
if (isset($condition['gender'])) {
unset($data['list']['filters']['channel']);
}
//过滤品牌
if (isset($condition['brand'])) {
unset($data['list']['filters']['brand']);
}
//过滤价格
if (isset($condition['price'])) {
unset($data['list']['filters']['price']);
unset($data['list']['filters']['customPrice']);
}
//过滤颜色
if (isset($condition['color'])) {
unset($data['list']['filters']['color']);
}
//过滤风格
if (isset($condition['style'])) {
unset($data['list']['filters']['seniorChose']);
}
//过滤尺码
if (isset($condition['size'])) {
unset($data['list']['filters']['size']);
}
return $data;
}
/**
* 根据product_sn查询产品图片信息
* @param $product_sn
* @param $options
... ...
... ... @@ -31,7 +31,7 @@ class SearchController extends WebAction
$condition[$key] = rawurldecode($val);
}
//关键词
$condition['query'] = 'vans';
$condition['query'] = '';
//性別(频道)
$gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1);
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : $gender_cookie ;
... ... @@ -56,6 +56,18 @@ class SearchController extends WebAction
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//自定义搜索价格
if (isset($condition['price']) || !empty($condition['price'])) {
$price = explode(',', $condition['price']);
if (!$price[0]) {
$price[0] = 0;
}
if ($price[1]) {
$price[1] = 99999;
}
$condition['price'] = implode(',', $price);
}
//返回搜索条件
$condition['needFilter'] = 1;
//过滤赠品
... ... @@ -78,7 +90,7 @@ class SearchController extends WebAction
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$searchData = SearchModel::getSearchData($params,$options);
$searchData = SearchModel::searchData($params,$options);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
$data = array(
... ...