Authored by 梁志锋

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into beta

@@ -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,8 +13,7 @@ class HelperSearch @@ -13,8 +13,7 @@ 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;
20 19
@@ -29,19 +28,13 @@ class HelperSearch @@ -29,19 +28,13 @@ class HelperSearch
29 */ 28 */
30 public static $listnav = array(); 29 public static $listnav = array();
31 30
32 -  
33 - private static function setFrom($from = '')  
34 - {  
35 - if ($from) {  
36 - self::$from = $from;  
37 - }  
38 - }  
39 //设置导航 31 //设置导航
40 - private static function setListNav($option = array()) 32 + private static function setListNav()
41 { 33 {
  34 + $options = self::$options;
42 $cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys'; 35 $cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
43 - if (isset($option['brandName']) && !empty($option['brandName'])) {  
44 - $initNav = $option['brandName']; 36 + if (isset($options['brandName']) && !empty($options['brandName'])) {
  37 + $initNav = $options['brandName'];
45 }else{ 38 }else{
46 $initNav = '列表'; 39 $initNav = '列表';
47 } 40 }
@@ -64,6 +57,7 @@ class HelperSearch @@ -64,6 +57,7 @@ class HelperSearch
64 { 57 {
65 $result = array(); 58 $result = array();
66 self::$params = $_GET; 59 self::$params = $_GET;
  60 + self::$options = $options;
67 unset(self::$params['/']); 61 unset(self::$params['/']);
68 unset(self::$params['page']); 62 unset(self::$params['page']);
69 unset(self::$params['/sale']); 63 unset(self::$params['/sale']);
@@ -80,10 +74,8 @@ class HelperSearch @@ -80,10 +74,8 @@ class HelperSearch
80 $result['filters']['checkedConditions']['clearUrl'] = self::current(); 74 $result['filters']['checkedConditions']['clearUrl'] = self::current();
81 //频道 75 //频道
82 $result['filters']['channel'] = self::gender($filter); 76 $result['filters']['channel'] = self::gender($filter);
83 - //分类  
84 - $result['filters']['sort'] = array();  
85 //品牌 77 //品牌
86 - $result['filters']['brand'] = self::brand($filter, $options); 78 + $result['filters']['brand'] = self::brand($filter);
87 //价格 79 //价格
88 $result['filters']['price'] = self::price($filter); 80 $result['filters']['price'] = self::price($filter);
89 $result['filters']['customPrice'] = self::customPrice($filter); 81 $result['filters']['customPrice'] = self::customPrice($filter);
@@ -109,8 +101,10 @@ class HelperSearch @@ -109,8 +101,10 @@ class HelperSearch
109 $result['opts']['pageCount'] = $data['data']['page_total']; 101 $result['opts']['pageCount'] = $data['data']['page_total'];
110 $result['opts']['nextHref'] = ($next = self::next($data['data']['page_total'],$data['data']['filter'])) ? $next['href'] : ''; 102 $result['opts']['nextHref'] = ($next = self::next($data['data']['page_total'],$data['data']['filter'])) ? $next['href'] : '';
111 $result['hasNextPage'] = self::next($data['data']['page_total']); 103 $result['hasNextPage'] = self::next($data['data']['page_total']);
112 - //分类  
113 - $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array(); 104 + //分类条件
  105 + $result['filters']['sort'] = isset($filter['group_sort']) ? self::searchSort($filter['group_sort']) : array();
  106 + //左侧分类分类
  107 + $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort']) : array();
114 //一周新品上架 108 //一周新品上架
115 $result['leftContent'][]['newSales'] = isset($filter['recent']) ? self::recentShelve($filter['recent']) : array(); 109 $result['leftContent'][]['newSales'] = isset($filter['recent']) ? self::recentShelve($filter['recent']) : array();
116 //全部折扣 110 //全部折扣
@@ -121,6 +115,9 @@ class HelperSearch @@ -121,6 +115,9 @@ class HelperSearch
121 $result['pager'] = self::pager($result['totalCount'],$options['viewNum']); 115 $result['pager'] = self::pager($result['totalCount'],$options['viewNum']);
122 //选中条件 116 //选中条件
123 $result['filters']['checkedConditions']['conditions'] = self::getSelected(); 117 $result['filters']['checkedConditions']['conditions'] = self::getSelected();
  118 + if (isset($options['controller']) && $options['controller'] == 'Search') {
  119 + self::setSearchNav($data['data']['total']);
  120 + }
124 $result['pathNav'] = self::$listnav; 121 $result['pathNav'] = self::$listnav;
125 return $result; 122 return $result;
126 } 123 }
@@ -193,6 +190,9 @@ class HelperSearch @@ -193,6 +190,9 @@ class HelperSearch
193 'name' => $pval['standard_name'], 190 'name' => $pval['standard_name'],
194 'href' => self::buildUrl($tmpParams) 191 'href' => self::buildUrl($tmpParams)
195 ); 192 );
  193 + if (self::checkSearch('parameter_' . $val['standard_id'])) {
  194 + return array();
  195 + }
196 } 196 }
197 $sub[] = array( 197 $sub[] = array(
198 'name' => $pval['standard_name'], 198 'name' => $pval['standard_name'],
@@ -232,6 +232,10 @@ class HelperSearch @@ -232,6 +232,10 @@ class HelperSearch
232 'href' => self::buildUrl($params) 232 'href' => self::buildUrl($params)
233 ); 233 );
234 } 234 }
  235 +
  236 + if (self::checkSearch('gender')) {
  237 + return array();
  238 + }
235 $result = array(); 239 $result = array();
236 foreach ($filter['gender'] as $key => $val) { 240 foreach ($filter['gender'] as $key => $val) {
237 $result[] = array( 241 $result[] = array(
@@ -247,14 +251,18 @@ class HelperSearch @@ -247,14 +251,18 @@ class HelperSearch
247 /** 251 /**
248 * 组织搜索列表页面的左侧分类 252 * 组织搜索列表页面的左侧分类
249 * @param array $sort 253 * @param array $sort
250 - * @param array $option  
251 * @return array 254 * @return array
252 */ 255 */
253 256
254 - public static function groupSort($sort, $option = array()) 257 + public static function groupSort($sort)
255 { 258 {
  259 +
  260 + $options = self::$options;
  261 + if (isset($options['controller']) && $options['controller'] != 'Search') {
  262 + return array();
  263 + }
256 //设置导航 264 //设置导航
257 - self::setListNav($option); 265 + self::setListNav($options);
258 $params = self::$params; 266 $params = self::$params;
259 $result = array( 267 $result = array(
260 'all' => array( 268 'all' => array(
@@ -294,16 +302,48 @@ class HelperSearch @@ -294,16 +302,48 @@ class HelperSearch
294 } 302 }
295 } 303 }
296 $result['list'] = $sortList; 304 $result['list'] = $sortList;
  305 +
297 return $result; 306 return $result;
298 } 307 }
299 308
  309 + public static function searchSort($sort)
  310 + {
  311 + $result = array();
  312 + $options = self::$options;
  313 + if (!isset($options['controller']) || $options['controller'] != 'Search') {
  314 + return $result;
  315 + }
  316 + $params = self::$params;
  317 + foreach ($sort as $key => $val) {
  318 + $result[$key]['id'] = $val['sort_id'];
  319 + $result[$key]['name'] = $val['sort_name'];
  320 + if (isset($val['sub']) && !empty($val['sub'])) {
  321 + foreach ($val['sub'] as $k => $v) {
  322 + $result[$key]['sub'][$k]['href'] = self::buildUrl(array('msort' => $val['sort_id'], 'misort' => $v['sort_id']));
  323 + $result[$key]['sub'][$k]['name'] = $v['sort_name'];
  324 + if (isset($params['misort']) && $params['misort'] == $v['sort_id']) {
  325 + unset($params['misort']);
  326 + self::$selected['sort'] = array(
  327 + 'name' => $v['sort_name'],
  328 + 'href' => self::buildUrl()
  329 + );
  330 + }
  331 +
  332 + }
  333 + }
  334 + }
  335 + if (self::checkSearch('msrot') || self::checkSearch('misort')) {
  336 + return array();
  337 + }
  338 + return $result;
  339 + }
300 /** 340 /**
301 * 品牌,可以多选 341 * 品牌,可以多选
302 * @param array $filter 342 * @param array $filter
303 - * @param array $options  
304 * @return array 343 * @return array
305 */ 344 */
306 - public static function brand($filter, $options = array()) { 345 + public static function brand($filter) {
  346 + $options = self::$options;
307 //品牌列表返回空 347 //品牌列表返回空
308 if (isset($options['brandName'])) { 348 if (isset($options['brandName'])) {
309 return array(); 349 return array();
@@ -311,11 +351,15 @@ class HelperSearch @@ -311,11 +351,15 @@ class HelperSearch
311 $result = array( 351 $result = array(
312 'default' => array() , 352 'default' => array() ,
313 'brandIndex' => array( 353 'brandIndex' => array(
314 - '0~9',  
315 - 'A~G',  
316 - 'H~N',  
317 - 'O~T',  
318 - 'U~Z') , 354 + array(
  355 + 'index' => 'all',
  356 + 'name' => '全部'
  357 + ),
  358 + array(
  359 + 'index' => '0-9',
  360 + 'name' => '0 ~ 9'
  361 + )
  362 + ),
319 'brandsShow' => array() 363 'brandsShow' => array()
320 ); 364 );
321 $params = self::$params; 365 $params = self::$params;
@@ -341,12 +385,18 @@ class HelperSearch @@ -341,12 +385,18 @@ class HelperSearch
341 ))); 385 )));
342 } 386 }
343 $this_brand = array( 387 $this_brand = array(
344 - 'brand_id' => $v['id'],  
345 - 'name' => $v['brand_name'],  
346 - 'alif' => $v['brand_alif'], 388 + 'id' => $v['id'],
347 'href' => $url, 389 'href' => $url,
  390 + 'name' => $v['brand_name'],
  391 + 'key' => $v['brand_name'],
348 'active' => in_array($v['id'], $brandIds) ? true : false 392 'active' => in_array($v['id'], $brandIds) ? true : false
349 ); 393 );
  394 + if (is_numeric($v['brand_alif'])) {
  395 + $this_brand['index'] = '0-9';
  396 + }
  397 + else {
  398 + $this_brand['index'] = strtolower($v['brand_alif']);
  399 + }
350 //默认品牌 400 //默认品牌
351 if (count($result['default']) < 10) { 401 if (count($result['default']) < 10) {
352 $result['default'][] = $this_brand; 402 $result['default'][] = $this_brand;
@@ -367,9 +417,16 @@ class HelperSearch @@ -367,9 +417,16 @@ class HelperSearch
367 'href' => self::buildUrl($params) 417 'href' => self::buildUrl($params)
368 ); 418 );
369 } 419 }
370 - //品牌列表排序  
371 ksort($brandList); 420 ksort($brandList);
  421 + //品牌列表排序, 添加品牌索引
  422 + $index_key = array();
372 foreach ($brandList as $key => $val) { 423 foreach ($brandList as $key => $val) {
  424 + if ($key && !in_array($key, $index_key)) {
  425 + $index['index'] = strtolower(($key));
  426 + $index['name'] = $key;
  427 + $result['brandIndex'][] = $index;
  428 + $index_key[] = $index;
  429 + }
373 if (is_array($val)) { 430 if (is_array($val)) {
374 foreach ($val as $v) { 431 foreach ($val as $v) {
375 $result['brandsShow'][] = $v; 432 $result['brandsShow'][] = $v;
@@ -378,6 +435,10 @@ class HelperSearch @@ -378,6 +435,10 @@ class HelperSearch
378 } 435 }
379 unset($brandList); 436 unset($brandList);
380 } 437 }
  438 + //搜索页已选中,返回空
  439 + if (self::checkSearch('brand')) {
  440 + return array();
  441 + }
381 return $result; 442 return $result;
382 } 443 }
383 /** 444 /**
@@ -402,6 +463,7 @@ class HelperSearch @@ -402,6 +463,7 @@ class HelperSearch
402 'href' => self::buildUrl($params) 463 'href' => self::buildUrl($params)
403 ); 464 );
404 } 465 }
  466 +
405 $result[] = array( 467 $result[] = array(
406 'name' => $v['size_name'], 468 'name' => $v['size_name'],
407 'href' => self::buildUrl(array_merge($params, array( 469 'href' => self::buildUrl(array_merge($params, array(
@@ -409,6 +471,9 @@ class HelperSearch @@ -409,6 +471,9 @@ class HelperSearch
409 ))) , 471 ))) ,
410 ); 472 );
411 } 473 }
  474 + if (self::checkSearch('size')) {
  475 + return array();
  476 + }
412 } 477 }
413 return $result; 478 return $result;
414 } 479 }
@@ -443,6 +508,9 @@ class HelperSearch @@ -443,6 +508,9 @@ class HelperSearch
443 ))) , 508 ))) ,
444 ); 509 );
445 } 510 }
  511 + if (self::checkSearch('color')) {
  512 + return array();
  513 + }
446 return $result; 514 return $result;
447 } 515 }
448 516
@@ -474,6 +542,9 @@ class HelperSearch @@ -474,6 +542,9 @@ class HelperSearch
474 ); 542 );
475 } 543 }
476 } 544 }
  545 + if (self::checkSearch('price')) {
  546 + return array();
  547 + }
477 //返回价格条件 548 //返回价格条件
478 foreach ($filter['price'] as $key => $val) { 549 foreach ($filter['price'] as $key => $val) {
479 $val = trim($val,'¥'); 550 $val = trim($val,'¥');
@@ -556,6 +627,10 @@ class HelperSearch @@ -556,6 +627,10 @@ class HelperSearch
556 'href' => $url, 627 'href' => $url,
557 ); 628 );
558 } 629 }
  630 + //搜索页已选中,返回空
  631 + if (self::checkSearch('style')) {
  632 + return array();
  633 + }
559 $data[0] = array( 634 $data[0] = array(
560 'attr' => 'style', 635 'attr' => 'style',
561 'name' => '风格', 636 'name' => '风格',
@@ -942,7 +1017,13 @@ class HelperSearch @@ -942,7 +1017,13 @@ class HelperSearch
942 } 1017 }
943 return $result; 1018 return $result;
944 } 1019 }
945 - //分页 1020 +
  1021 + /**
  1022 + * 分页
  1023 + * @param $total
  1024 + * @param $viewNum
  1025 + * @return mixed
  1026 + */
946 public static function pager($total,$viewNum){ 1027 public static function pager($total,$viewNum){
947 $Paging = new Paging('Yoho'); 1028 $Paging = new Paging('Yoho');
948 return $Paging->setTotal($total)->setSize($viewNum)->view(0); 1029 return $Paging->setTotal($total)->setSize($viewNum)->view(0);
@@ -968,4 +1049,67 @@ class HelperSearch @@ -968,4 +1049,67 @@ class HelperSearch
968 return $result; 1049 return $result;
969 } 1050 }
970 } 1051 }
  1052 +
  1053 + /**
  1054 + * 组织品牌店铺信息
  1055 + */
  1056 + public static function shop($shop)
  1057 + {
  1058 + $url = Helpers::url('','',$shop['brand_domain']);
  1059 + $shopEntry = array();
  1060 + $sort = array();
  1061 + foreach ($shop['sort'] as $msort) {
  1062 + if (!isset($msort['sub']) || empty($msort['sub'])) {
  1063 + continue;
  1064 + }
  1065 + foreach ($msort['sub'] as $mkey=>$misort) {
  1066 + if (count($sort) >= 10) {
  1067 + break 2;
  1068 + }
  1069 + $sortInfo['href'] = $url.'/?msort=' . $msort['sort_id'] . '&misort=' . $misort['sort_id'];
  1070 + $sortInfo['name'] = $misort['sort_name'];
  1071 + $sort[] = $sortInfo;
  1072 + }
  1073 +
  1074 + }
  1075 + $shopEntry['home'] = $url;
  1076 + $shopEntry['logo'] = Images::getSourceUrl($shop['brand_ico'],'brandLogo');
  1077 + $shopEntry['shopName'] = $shop['brand_name'];
  1078 + $shopEntry['sort'] = $sort;
  1079 + return $shopEntry;
  1080 + }
  1081 +
  1082 + public static function checkSearch($param)
  1083 + {
  1084 + if (isset(self::$params[$param]) && isset(self::$options['controller']) && self::$options['controller'] == 'Search') {
  1085 + return true;
  1086 + }
  1087 +
  1088 + }
  1089 +
  1090 + /**
  1091 + * 设置搜索页导航
  1092 + * @param $total
  1093 + */
  1094 + public static function setSearchNav($total)
  1095 + {
  1096 + self::$listnav[0] = array(
  1097 + 'href' => '/',
  1098 + 'name' => '首页'
  1099 + );
  1100 + $param = self::$params;
  1101 + $options = self::$options;
  1102 + if (isset($options['controller']) && $options['controller'] == 'Search' && isset($param['query'])) {
  1103 + self::$listnav[1] = array(
  1104 + 'href' => '',
  1105 + 'name' => "".$param['query']." ".$total."个结果"
  1106 + );
  1107 + }else{
  1108 + self::$listnav[1] = array(
  1109 + 'href' => '',
  1110 + 'name' => '所有商品'
  1111 + );
  1112 + }
  1113 +
  1114 + }
971 } 1115 }
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}}
@@ -136,9 +136,10 @@ function picCaptchaAjaxFn(page, callback) { @@ -136,9 +136,10 @@ function picCaptchaAjaxFn(page, callback) {
136 type: 'POST', 136 type: 'POST',
137 url: url, 137 url: url,
138 data: { 138 data: {
139 - code: $ca.val(),  
140 - mobile: $pn.val(),  
141 - area: $region.text().split('+')[1] 139 + code: $ca.val()
  140 +
  141 + //mobile: $pn.val(),
  142 + //area: $region.text().split('+')[1]
142 } 143 }
143 }).then(function(data) { 144 }).then(function(data) {
144 switch (data.code) { 145 switch (data.code) {
@@ -530,7 +531,7 @@ exports.init = function(page) { @@ -530,7 +531,7 @@ exports.init = function(page) {
530 data: { 531 data: {
531 area: $region.text().split('+')[1], 532 area: $region.text().split('+')[1],
532 mobile: $pn.val(), 533 mobile: $pn.val(),
533 - captcha: $ca.val(), 534 + verifyCode: $ca.val(),
534 code: $mc.val(), 535 code: $mc.val(),
535 password: $pwd.val() 536 password: $pwd.val()
536 } 537 }
@@ -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 }