Authored by 周少峰

搜索页面搜索条件设置

@@ -4,6 +4,7 @@ namespace LibModels\Web\Product; @@ -4,6 +4,7 @@ namespace LibModels\Web\Product;
4 use Api\Yohobuy; 4 use Api\Yohobuy;
5 class SearchData extends \LibModels\Wap\Product\SearchData 5 class SearchData extends \LibModels\Wap\Product\SearchData
6 { 6 {
  7 + public static $shops_url = 'http://101.200.31.165/yohosearch/shops.json';
7 /** 8 /**
8 * 获取搜索的服务地址 9 * 获取搜索的服务地址
9 * 10 *
@@ -129,6 +130,16 @@ class SearchData extends \LibModels\Wap\Product\SearchData @@ -129,6 +130,16 @@ class SearchData extends \LibModels\Wap\Product\SearchData
129 } 130 }
130 131
131 /** 132 /**
  133 + * 搜索品牌店铺信息
  134 + * @param array $params 参数
  135 + * @return array
  136 + */
  137 + public static function getShop(array $params)
  138 + {
  139 + return Yohobuy::get(self::$shops_url,$params);
  140 + }
  141 +
  142 + /**
132 * 获取最近浏览记录 143 * 获取最近浏览记录
133 * @param int $limit 144 * @param int $limit
134 * @return json 145 * @return json
@@ -13,10 +13,10 @@ class HelperSearch @@ -13,10 +13,10 @@ class HelperSearch
13 */ 13 */
14 public static $params = array(); 14 public static $params = array();
15 15
16 - private static $from = '';  
17 - 16 + public static $options = array();
18 //当前页 17 //当前页
19 public static $page = 1; 18 public static $page = 1;
  19 + public static $siteDomain = '.yohobuy.com';
20 20
21 /** 21 /**
22 * 选中的条件 22 * 选中的条件
@@ -29,19 +29,16 @@ class HelperSearch @@ -29,19 +29,16 @@ class HelperSearch
29 */ 29 */
30 public static $listnav = array(); 30 public static $listnav = array();
31 31
32 -  
33 - private static function setFrom($from = '')  
34 - {  
35 - if ($from) {  
36 - self::$from = $from;  
37 - }  
38 - }  
39 //设置导航 32 //设置导航
40 - private static function setListNav($option = array()) 33 + private static function setListNav()
41 { 34 {
  35 + if (isset(self::$options['controller']) && self::$options['controller'] == 'Search') {
  36 +
  37 + }
  38 + $options = self::$options;
42 $cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys'; 39 $cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
43 - if (isset($option['brandName']) && !empty($option['brandName'])) {  
44 - $initNav = $option['brandName']; 40 + if (isset($options['brandName']) && !empty($options['brandName'])) {
  41 + $initNav = $options['brandName'];
45 }else{ 42 }else{
46 $initNav = '列表'; 43 $initNav = '列表';
47 } 44 }
@@ -64,6 +61,7 @@ class HelperSearch @@ -64,6 +61,7 @@ class HelperSearch
64 { 61 {
65 $result = array(); 62 $result = array();
66 self::$params = $_GET; 63 self::$params = $_GET;
  64 + self::$options = $options;
67 unset(self::$params['/']); 65 unset(self::$params['/']);
68 unset(self::$params['page']); 66 unset(self::$params['page']);
69 unset(self::$params['/sale']); 67 unset(self::$params['/sale']);
@@ -80,10 +78,8 @@ class HelperSearch @@ -80,10 +78,8 @@ class HelperSearch
80 $result['filters']['checkedConditions']['clearUrl'] = self::current(); 78 $result['filters']['checkedConditions']['clearUrl'] = self::current();
81 //频道 79 //频道
82 $result['filters']['channel'] = self::gender($filter); 80 $result['filters']['channel'] = self::gender($filter);
83 - //分类  
84 - $result['filters']['sort'] = array();  
85 //品牌 81 //品牌
86 - $result['filters']['brand'] = self::brand($filter, $options); 82 + $result['filters']['brand'] = self::brand($filter);
87 //价格 83 //价格
88 $result['filters']['price'] = self::price($filter); 84 $result['filters']['price'] = self::price($filter);
89 $result['filters']['customPrice'] = self::customPrice($filter); 85 $result['filters']['customPrice'] = self::customPrice($filter);
@@ -109,8 +105,10 @@ class HelperSearch @@ -109,8 +105,10 @@ class HelperSearch
109 $result['opts']['pageCount'] = $data['data']['page_total']; 105 $result['opts']['pageCount'] = $data['data']['page_total'];
110 $result['opts']['nextHref'] = ($next = self::next($data['data']['page_total'],$data['data']['filter'])) ? $next['href'] : ''; 106 $result['opts']['nextHref'] = ($next = self::next($data['data']['page_total'],$data['data']['filter'])) ? $next['href'] : '';
111 $result['hasNextPage'] = self::next($data['data']['page_total']); 107 $result['hasNextPage'] = self::next($data['data']['page_total']);
112 - //分类  
113 - $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array(); 108 + //分类条件
  109 + $result['filters']['sort'] = isset($filter['group_sort']) ? self::searchSort($filter['group_sort']) : array();
  110 + //左侧分类分类
  111 + $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort']) : array();
114 //一周新品上架 112 //一周新品上架
115 $result['leftContent'][]['newSales'] = isset($filter['recent']) ? self::recentShelve($filter['recent']) : array(); 113 $result['leftContent'][]['newSales'] = isset($filter['recent']) ? self::recentShelve($filter['recent']) : array();
116 //全部折扣 114 //全部折扣
@@ -121,6 +119,9 @@ class HelperSearch @@ -121,6 +119,9 @@ class HelperSearch
121 $result['pager'] = self::pager($result['totalCount'],$options['viewNum']); 119 $result['pager'] = self::pager($result['totalCount'],$options['viewNum']);
122 //选中条件 120 //选中条件
123 $result['filters']['checkedConditions']['conditions'] = self::getSelected(); 121 $result['filters']['checkedConditions']['conditions'] = self::getSelected();
  122 + if (isset($options['controller']) && $options['controller'] == 'Search') {
  123 + self::setSearchNav($data['data']['total']);
  124 + }
124 $result['pathNav'] = self::$listnav; 125 $result['pathNav'] = self::$listnav;
125 return $result; 126 return $result;
126 } 127 }
@@ -193,6 +194,9 @@ class HelperSearch @@ -193,6 +194,9 @@ class HelperSearch
193 'name' => $pval['standard_name'], 194 'name' => $pval['standard_name'],
194 'href' => self::buildUrl($tmpParams) 195 'href' => self::buildUrl($tmpParams)
195 ); 196 );
  197 + if (self::checkSearch('parameter_' . $val['standard_id'])) {
  198 + return array();
  199 + }
196 } 200 }
197 $sub[] = array( 201 $sub[] = array(
198 'name' => $pval['standard_name'], 202 'name' => $pval['standard_name'],
@@ -222,9 +226,6 @@ class HelperSearch @@ -222,9 +226,6 @@ class HelperSearch
222 } 226 }
223 $params = self::$params; 227 $params = self::$params;
224 $gender = isset($params['gender']) ? $params['gender'] : ''; 228 $gender = isset($params['gender']) ? $params['gender'] : '';
225 - if (isset($params['gender'])) {  
226 - unset($params['gender']);  
227 - }  
228 //设置选中 229 //设置选中
229 if ($gender == '1,3' || $gender == '2,3') { 230 if ($gender == '1,3' || $gender == '2,3') {
230 self::$selected['gender'] = array( 231 self::$selected['gender'] = array(
@@ -232,6 +233,12 @@ class HelperSearch @@ -232,6 +233,12 @@ class HelperSearch
232 'href' => self::buildUrl($params) 233 'href' => self::buildUrl($params)
233 ); 234 );
234 } 235 }
  236 + if (isset($params['gender'])) {
  237 + unset($params['gender']);
  238 + }
  239 + if (self::checkSearch('gender')) {
  240 + return array();
  241 + }
235 $result = array(); 242 $result = array();
236 foreach ($filter['gender'] as $key => $val) { 243 foreach ($filter['gender'] as $key => $val) {
237 $result[] = array( 244 $result[] = array(
@@ -247,12 +254,15 @@ class HelperSearch @@ -247,12 +254,15 @@ class HelperSearch
247 /** 254 /**
248 * 组织搜索列表页面的左侧分类 255 * 组织搜索列表页面的左侧分类
249 * @param array $sort 256 * @param array $sort
250 - * @param array $option  
251 * @return array 257 * @return array
252 */ 258 */
253 259
254 - public static function groupSort($sort, $option = array()) 260 + public static function groupSort($sort)
255 { 261 {
  262 + $option = self::$options;
  263 + if (!isset($option['controller']) || $option['controller'] != 'Search') {
  264 + return array();
  265 + }
256 //设置导航 266 //设置导航
257 self::setListNav($option); 267 self::setListNav($option);
258 $params = self::$params; 268 $params = self::$params;
@@ -297,13 +307,51 @@ class HelperSearch @@ -297,13 +307,51 @@ class HelperSearch
297 return $result; 307 return $result;
298 } 308 }
299 309
  310 + public static function searchSort($sort)
  311 + {
  312 + $result = array();
  313 + $options = self::$options;
  314 + if (!isset($options['controller']) || $options['controller'] != 'Search') {
  315 + return $result;
  316 + }
  317 + $params = self::$params;
  318 + foreach ($sort as $key => $val) {
  319 + $result[$key]['id'] = $val['sort_id'];
  320 + $result[$key]['name'] = $val['sort_name'];
  321 + if (isset($params['msort']) && $params['msort'] == $val['sort_id']) {
  322 + unset($params['msort']);
  323 + self::$selected['sort'] = array(
  324 + 'name' => $val['sort_name'],
  325 + 'href' => self::buildUrl($params)
  326 + );
  327 + }
  328 + if (isset($val['sub']) && !empty($val['sub'])) {
  329 + foreach ($val['sub'] as $k => $v) {
  330 + $result[$key]['sub'][$k]['href'] = self::buildUrl(array_merge($params, array('msort' => $val['sort_id'], 'misort' => $v['sort_id'])));
  331 + $result[$key]['sub'][$k]['name'] = $v['sort_name'];
  332 + if (isset($params['misort']) && $params['misort'] == $v['sort_id']) {
  333 + unset($params['misort']);
  334 + self::$selected['sort'] = array(
  335 + 'name' => $v['sort_name'],
  336 + 'href' => self::buildUrl($params)
  337 + );
  338 + }
  339 +
  340 + }
  341 + }
  342 + }
  343 + if (self::checkSearch('msrot') || self::checkSearch('misort')) {
  344 + return array();
  345 + }
  346 + return $result;
  347 + }
300 /** 348 /**
301 * 品牌,可以多选 349 * 品牌,可以多选
302 * @param array $filter 350 * @param array $filter
303 - * @param array $options  
304 * @return array 351 * @return array
305 */ 352 */
306 - public static function brand($filter, $options = array()) { 353 + public static function brand($filter) {
  354 + $options = self::$options;
307 //品牌列表返回空 355 //品牌列表返回空
308 if (isset($options['brandName'])) { 356 if (isset($options['brandName'])) {
309 return array(); 357 return array();
@@ -311,11 +359,15 @@ class HelperSearch @@ -311,11 +359,15 @@ class HelperSearch
311 $result = array( 359 $result = array(
312 'default' => array() , 360 'default' => array() ,
313 'brandIndex' => array( 361 'brandIndex' => array(
314 - '0~9',  
315 - 'A~G',  
316 - 'H~N',  
317 - 'O~T',  
318 - 'U~Z') , 362 + array(
  363 + 'index' => 'all',
  364 + 'name' => '全部'
  365 + ),
  366 + array(
  367 + 'index' => '0-9',
  368 + 'name' => '0 ~ 9'
  369 + )
  370 + ),
319 'brandsShow' => array() 371 'brandsShow' => array()
320 ); 372 );
321 $params = self::$params; 373 $params = self::$params;
@@ -341,12 +393,18 @@ class HelperSearch @@ -341,12 +393,18 @@ class HelperSearch
341 ))); 393 )));
342 } 394 }
343 $this_brand = array( 395 $this_brand = array(
344 - 'brand_id' => $v['id'],  
345 - 'name' => $v['brand_name'],  
346 - 'alif' => $v['brand_alif'], 396 + 'id' => $v['id'],
347 'href' => $url, 397 'href' => $url,
  398 + 'name' => $v['brand_name'],
  399 + 'key' => $v['brand_name'],
348 'active' => in_array($v['id'], $brandIds) ? true : false 400 'active' => in_array($v['id'], $brandIds) ? true : false
349 ); 401 );
  402 + if (is_numeric($v['brand_alif'])) {
  403 + $this_brand['index'] = '0-9';
  404 + }
  405 + else {
  406 + $this_brand['index'] = strtolower($v['brand_alif']);
  407 + }
350 //默认品牌 408 //默认品牌
351 if (count($result['default']) < 10) { 409 if (count($result['default']) < 10) {
352 $result['default'][] = $this_brand; 410 $result['default'][] = $this_brand;
@@ -367,9 +425,20 @@ class HelperSearch @@ -367,9 +425,20 @@ class HelperSearch
367 'href' => self::buildUrl($params) 425 'href' => self::buildUrl($params)
368 ); 426 );
369 } 427 }
370 - //品牌列表排序 428 + //搜索页已选中,返回空
  429 + if (self::checkSearch('brand')) {
  430 + return array();
  431 + }
371 ksort($brandList); 432 ksort($brandList);
  433 + //品牌列表排序, 添加品牌索引
  434 + $index_key = array();
372 foreach ($brandList as $key => $val) { 435 foreach ($brandList as $key => $val) {
  436 + if ($key && !in_array($key, $index_key)) {
  437 + $index['index'] = strtolower(($key));
  438 + $index['name'] = $key;
  439 + $result['brandIndex'][] = $index;
  440 + $index_key[] = $index;
  441 + }
373 if (is_array($val)) { 442 if (is_array($val)) {
374 foreach ($val as $v) { 443 foreach ($val as $v) {
375 $result['brandsShow'][] = $v; 444 $result['brandsShow'][] = $v;
@@ -402,6 +471,9 @@ class HelperSearch @@ -402,6 +471,9 @@ class HelperSearch
402 'href' => self::buildUrl($params) 471 'href' => self::buildUrl($params)
403 ); 472 );
404 } 473 }
  474 + if (self::checkSearch('size')) {
  475 + return array();
  476 + }
405 $result[] = array( 477 $result[] = array(
406 'name' => $v['size_name'], 478 'name' => $v['size_name'],
407 'href' => self::buildUrl(array_merge($params, array( 479 'href' => self::buildUrl(array_merge($params, array(
@@ -443,6 +515,9 @@ class HelperSearch @@ -443,6 +515,9 @@ class HelperSearch
443 ))) , 515 ))) ,
444 ); 516 );
445 } 517 }
  518 + if (self::checkSearch('color')) {
  519 + return array();
  520 + }
446 return $result; 521 return $result;
447 } 522 }
448 523
@@ -474,6 +549,9 @@ class HelperSearch @@ -474,6 +549,9 @@ class HelperSearch
474 ); 549 );
475 } 550 }
476 } 551 }
  552 + if (self::checkSearch('price')) {
  553 + return array();
  554 + }
477 //返回价格条件 555 //返回价格条件
478 foreach ($filter['price'] as $key => $val) { 556 foreach ($filter['price'] as $key => $val) {
479 $val = trim($val,'¥'); 557 $val = trim($val,'¥');
@@ -556,6 +634,10 @@ class HelperSearch @@ -556,6 +634,10 @@ class HelperSearch
556 'href' => $url, 634 'href' => $url,
557 ); 635 );
558 } 636 }
  637 + //搜索页已选中,返回空
  638 + if (self::checkSearch('style')) {
  639 + return array();
  640 + }
559 $data[0] = array( 641 $data[0] = array(
560 'attr' => 'style', 642 'attr' => 'style',
561 'name' => '风格', 643 'name' => '风格',
@@ -942,7 +1024,13 @@ class HelperSearch @@ -942,7 +1024,13 @@ class HelperSearch
942 } 1024 }
943 return $result; 1025 return $result;
944 } 1026 }
945 - //分页 1027 +
  1028 + /**
  1029 + * 分页
  1030 + * @param $total
  1031 + * @param $viewNum
  1032 + * @return mixed
  1033 + */
946 public static function pager($total,$viewNum){ 1034 public static function pager($total,$viewNum){
947 $Paging = new Paging('Yoho'); 1035 $Paging = new Paging('Yoho');
948 return $Paging->setTotal($total)->setSize($viewNum)->view(0); 1036 return $Paging->setTotal($total)->setSize($viewNum)->view(0);
@@ -968,4 +1056,66 @@ class HelperSearch @@ -968,4 +1056,66 @@ class HelperSearch
968 return $result; 1056 return $result;
969 } 1057 }
970 } 1058 }
  1059 +
  1060 + /**
  1061 + * 组织品牌店铺信息
  1062 + */
  1063 + public static function shop($shop)
  1064 + {
  1065 + $shopEntry = array();
  1066 + $sort = array();
  1067 + foreach ($shop['sort'] as $msort) {
  1068 + if (!isset($msort['sub']) || empty($msort['sub'])) {
  1069 + continue;
  1070 + }
  1071 + foreach ($msort['sub'] as $mkey=>$misort) {
  1072 + if (count($sort) >= 10) {
  1073 + break 2;
  1074 + }
  1075 + $sortInfo['href'] = 'http://' . $shop['brand_domain'] . self::$siteDomain.'/?msort=' . $msort['sort_id'] . '&misort=' . $misort['sort_id'];
  1076 + $sortInfo['name'] = $misort['sort_name'];
  1077 + $sort[] = $sortInfo;
  1078 + }
  1079 +
  1080 + }
  1081 + $shopEntry['home'] = $shop['brand_domain'].'yohobuy.com';
  1082 + $shopEntry['logo'] = Images::getSourceUrl($shop['brand_ico'],'brandLogo');
  1083 + $shopEntry['shopName'] = $shop['brand_name'];
  1084 + $shopEntry['sort'] = $sort;
  1085 + return $shopEntry;
  1086 + }
  1087 +
  1088 + public static function checkSearch($param)
  1089 + {
  1090 + if (isset(self::$params[$param]) && isset(self::$options['controller']) && self::$options['controller'] == 'Search') {
  1091 + return true;
  1092 + }
  1093 +
  1094 + }
  1095 +
  1096 + /**
  1097 + * 设置搜索页导航
  1098 + * @param $total
  1099 + */
  1100 + public static function setSearchNav($total)
  1101 + {
  1102 + self::$listnav[0] = array(
  1103 + 'href' => '/',
  1104 + 'name' => '首页'
  1105 + );
  1106 + $param = self::$params;
  1107 + $options = self::$options;
  1108 + if (isset($options['controller']) && $options['controller'] == 'Search' && isset($param['query'])) {
  1109 + self::$listnav[1] = array(
  1110 + 'href' => '',
  1111 + 'name' => "".$param['query']." ".$total."个结果"
  1112 + );
  1113 + }else{
  1114 + self::$listnav[1] = array(
  1115 + 'href' => '',
  1116 + 'name' => '所有商品'
  1117 + );
  1118 + }
  1119 +
  1120 + }
971 } 1121 }
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="product-search-page product-page yoho-page center-content"> 2 <div class="product-search-page product-page yoho-page center-content">
3 {{# search}} 3 {{# search}}
4 - {{> layout/path-nav}} 4 + {{> layout/path-nav}}
5 5
6 - {{> product/standard-content}} 6 + {{> product/shop-entry}}
7 7
8 - {{> product/latest-walk}} 8 + {{> product/standard-content}}
  9 +
  10 + {{> product/latest-walk}}
9 {{/ search}} 11 {{/ search}}
10 </div> 12 </div>
11 -{{> layout/footer}}  
  13 +{{> layout/footer}}
@@ -49,12 +49,7 @@ class SearchModel @@ -49,12 +49,7 @@ class SearchModel
49 //用户浏览记录 49 //用户浏览记录
50 $result['data']['filter']['review'] = SearchData::getRecentReview(); 50 $result['data']['filter']['review'] = SearchData::getRecentReview();
51 // 组织模板数据 51 // 组织模板数据
52 - $list = HelperSearch::getList($result, $options);  
53 - $data = array(  
54 - //初始化js  
55 - 'productListPage' => true,  
56 - 'list' => $list  
57 - ); 52 + $data = HelperSearch::getList($result, $options);
58 } 53 }
59 return $data; 54 return $data;
60 } 55 }
@@ -67,31 +62,21 @@ class SearchModel @@ -67,31 +62,21 @@ class SearchModel
67 */ 62 */
68 public static function searchData($condition, $options){ 63 public static function searchData($condition, $options){
69 $data = self::getSearchData($condition, $options); 64 $data = self::getSearchData($condition, $options);
70 - //过滤频道  
71 - if (isset($condition['gender'])) {  
72 - unset($data['list']['filters']['channel']);  
73 - }  
74 - //过滤品牌  
75 - if (isset($condition['brand'])) {  
76 - unset($data['list']['filters']['brand']);  
77 - }  
78 - //过滤价格  
79 - if (isset($condition['price'])) {  
80 - unset($data['list']['filters']['price']);  
81 - unset($data['list']['filters']['customPrice']);  
82 - }  
83 - //过滤颜色  
84 - if (isset($condition['color'])) {  
85 - unset($data['list']['filters']['color']);  
86 - }  
87 - //过滤风格  
88 - if (isset($condition['style'])) {  
89 - unset($data['list']['filters']['seniorChose']);  
90 - }  
91 - //过滤尺码  
92 - if (isset($condition['size'])) {  
93 - unset($data['list']['filters']['size']); 65 + //获取品牌店铺信息
  66 + if (isset($condition['query'])) {
  67 + $param['keyword'] = $condition['query'];
  68 + $result = SearchData::getShop($param);
  69 + if (isset($result['code']) && $result['code'] === 200 && isset($result['data']) && !empty($result['data'])) {
  70 + //调用品牌分类
  71 + $class['brand'] = $result['data']['id'];
  72 + $brandSort = SearchData::getClassesData($class);
  73 + $shop = $result['data'];
  74 + if (isset($brandSort['data']['sort']) && !empty($brandSort['data']['sort']))
  75 + $shop['sort'] = $brandSort['data']['sort'];
  76 + $shopEntry = HelperSearch::shop($shop);
  77 + }
94 } 78 }
  79 + $data['shopEntry'] = isset($shopEntry) ? $shopEntry : array();
95 return $data; 80 return $data;
96 81
97 } 82 }
@@ -90,7 +90,12 @@ class ListController extends WebAction @@ -90,7 +90,12 @@ class ListController extends WebAction
90 $params = array_filter($params); 90 $params = array_filter($params);
91 //每页记录数减1,下一页占位 91 //每页记录数减1,下一页占位
92 $params['viewNum'] = $params['viewNum'] - 1; 92 $params['viewNum'] = $params['viewNum'] - 1;
93 - $data = SearchModel::getSearchData($params,$options); 93 + $list = SearchModel::getSearchData($params,$options);
  94 + $data = array(
  95 + //初始化js
  96 + 'productListPage' => true,
  97 + 'list' => $list
  98 + );
94 $cate = array('boys','girls','kids','lifestyle'); 99 $cate = array('boys','girls','kids','lifestyle');
95 $this->setWebNavHeader($cate[$gender-1]); 100 $this->setWebNavHeader($cate[$gender-1]);
96 $this->_view->display('list', $data); 101 $this->_view->display('list', $data);
@@ -30,8 +30,6 @@ class SearchController extends WebAction @@ -30,8 +30,6 @@ class SearchController extends WebAction
30 foreach($condition as $key => $val){ 30 foreach($condition as $key => $val){
31 $condition[$key] = rawurldecode($val); 31 $condition[$key] = rawurldecode($val);
32 } 32 }
33 - //关键词  
34 - $condition['query'] = '鞋';  
35 //性別(频道) 33 //性別(频道)
36 $gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1); 34 $gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1);
37 $gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : $gender_cookie ; 35 $gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : $gender_cookie ;
@@ -57,7 +55,7 @@ class SearchController extends WebAction @@ -57,7 +55,7 @@ class SearchController extends WebAction
57 $minImgSize = array(60, 80); 55 $minImgSize = array(60, 80);
58 } 56 }
59 //自定义搜索价格 57 //自定义搜索价格
60 - if (isset($condition['price']) || !empty($condition['price'])) { 58 + if (isset($condition['price']) && !empty($condition['price'])) {
61 $price = explode(',', $condition['price']); 59 $price = explode(',', $condition['price']);
62 if (!$price[0]) { 60 if (!$price[0]) {
63 $price[0] = 0; 61 $price[0] = 0;
@@ -90,13 +88,15 @@ class SearchController extends WebAction @@ -90,13 +88,15 @@ class SearchController extends WebAction
90 $params = array_filter($params); 88 $params = array_filter($params);
91 //每页记录数减1,下一页占位 89 //每页记录数减1,下一页占位
92 $params['viewNum'] = $params['viewNum'] - 1; 90 $params['viewNum'] = $params['viewNum'] - 1;
  91 + $options['controller'] = $this->_request->controller;
93 $searchData = SearchModel::searchData($params,$options); 92 $searchData = SearchModel::searchData($params,$options);
94 $cate = array('boys','girls','kids','lifestyle'); 93 $cate = array('boys','girls','kids','lifestyle');
95 $this->setWebNavHeader($cate[$gender-1]); 94 $this->setWebNavHeader($cate[$gender-1]);
96 $data = array( 95 $data = array(
  96 + //初始化js
97 'searchListPage' => true, 97 'searchListPage' => true,
  98 + 'search' => $searchData
98 ); 99 );
99 - $data['search'] = $searchData['list'];  
100 $this->_view->display('search', $data); 100 $this->_view->display('search', $data);
101 } 101 }
102 } 102 }