Authored by 周少峰

获取高级选项搜索条件

@@ -110,7 +110,7 @@ class SearchModel @@ -110,7 +110,7 @@ class SearchModel
110 ); 110 );
111 //接收高级选项 111 //接收高级选项
112 foreach ($_GET as $key =>$val) { 112 foreach ($_GET as $key =>$val) {
113 - if (strpos('parameter_',$key) !== false) { 113 + if (strpos($key, 'parameter_') !== false) {
114 $condition[$key] = (int) $val; 114 $condition[$key] = (int) $val;
115 } 115 }
116 } 116 }
@@ -220,7 +220,7 @@ class SearchModel @@ -220,7 +220,7 @@ class SearchModel
220 $data .= '<li><a style="display: block;" href="http://search.yohobuy.com/?query='.$v['item'].'" class="clearfix clear search-item" title="'.$v['item'].'" act="http://search.yohobuy.com/?query='.$v['item'].'"><span class="searchvalue" >'.$v['item'].'</span><span class="valuenum">约'.$v['frequency'].'个商品</span></a></li>'; 220 $data .= '<li><a style="display: block;" href="http://search.yohobuy.com/?query='.$v['item'].'" class="clearfix clear search-item" title="'.$v['item'].'" act="http://search.yohobuy.com/?query='.$v['item'].'"><span class="searchvalue" >'.$v['item'].'</span><span class="valuenum">约'.$v['frequency'].'个商品</span></a></li>';
221 } 221 }
222 } 222 }
223 - echo $data; 223 + return $data;
224 } 224 }
225 225
226 /** 226 /**
@@ -21,11 +21,13 @@ class SearchController extends WebAction @@ -21,11 +21,13 @@ class SearchController extends WebAction
21 */ 21 */
22 public function suggestAction() 22 public function suggestAction()
23 { 23 {
  24 + $suggest = '';
24 $query = rawurldecode($this->get('query')); 25 $query = rawurldecode($this->get('query'));
25 if ($query) { 26 if ($query) {
26 $param['query'] = $query; 27 $param['query'] = $query;
27 - SearchModel::getSuggest($param); 28 + $suggest = SearchModel::getSuggest($param);
28 } 29 }
  30 + echo $suggest;
29 } 31 }
30 32
31 /** 33 /**
@@ -35,7 +37,6 @@ class SearchController extends WebAction @@ -35,7 +37,6 @@ class SearchController extends WebAction
35 { 37 {
36 $condition['msort'] = $this->get('msort'); 38 $condition['msort'] = $this->get('msort');
37 $size = SearchModel::getSortSize($condition); 39 $size = SearchModel::getSortSize($condition);
38 - print_r($size); exit;  
39 $this->echoJson($size); 40 $this->echoJson($size);
40 } 41 }
41 } 42 }