Authored by 郭成尧

'filter-params'

@@ -128,10 +128,15 @@ class SearchModel @@ -128,10 +128,15 @@ class SearchModel
128 return $result; 128 return $result;
129 } 129 }
130 130
131 - public static function filter() 131 + /**
  132 + * @param array $params 直接传筛选参数
  133 + * @return array
  134 + */
  135 + public static function filter($params = array())
132 { 136 {
133 $data = array(); 137 $data = array();
134 138
  139 + if (empty($params)) {
135 $condition = filter_input_array(INPUT_GET, array( 140 $condition = filter_input_array(INPUT_GET, array(
136 'query' => FILTER_DEFAULT, 141 'query' => FILTER_DEFAULT,
137 'brand' => FILTER_DEFAULT, 142 'brand' => FILTER_DEFAULT,
@@ -193,6 +198,10 @@ class SearchModel @@ -193,6 +198,10 @@ class SearchModel
193 $condition['style'] = rawurldecode($condition['style']); 198 $condition['style'] = rawurldecode($condition['style']);
194 } 199 }
195 200
  201 + } else {
  202 + $condition = $params;
  203 + }
  204 +
196 // 区别各种列表页面的筛选数据 205 // 区别各种列表页面的筛选数据
197 $data = self::getFilterData($condition); 206 $data = self::getFilterData($condition);
198 207
@@ -485,19 +485,26 @@ class IndexController extends AbstractAction @@ -485,19 +485,26 @@ class IndexController extends AbstractAction
485 exit; 485 exit;
486 } 486 }
487 487
488 - $filter = Product\SearchModel::filter(); 488 + /* tar add 160826 */
  489 + $data['shopIdForFilter'] = $shopId;
  490 + $data['gender'] = $this->get('gender');
  491 + $data['channel'] = $this->get('yh_channel') ? $this->get('yh_channel') : Helpers::getChannelByCookie();
  492 +
  493 + $filter = Product\SearchModel::filter(array(
  494 + 'shop' => $shopId,
  495 + 'gender' => $data['gender'],
  496 + 'channel' => $data['channel']
  497 + ));
  498 +
489 $data['filter'] = $filter['filter']; 499 $data['filter'] = $filter['filter'];
490 500
491 /* tar add 160931 */ 501 /* tar add 160931 */
492 $data['goods'] = \Product\SearchModel::search(array( 502 $data['goods'] = \Product\SearchModel::search(array(
493 - 'shop' => $shopId 503 + 'shop' => $shopId,
  504 + 'gender' => $data['gender'],
  505 + 'channel' => $data['channel']
494 )); 506 ));
495 507
496 - /* tar add 160826 */  
497 - $data['shopIdForFilter'] = $shopId;  
498 - $data['gender'] = $this->get('gender');  
499 - $data['channel'] = $this->get('yh_channel') ? $this->get('yh_channel') : Helpers::getChannelByCookie();  
500 -  
501 $this->_view->display('shop', array( 508 $this->_view->display('shop', array(
502 'shopIndex' => $data, 509 'shopIndex' => $data,
503 'shopPage' => array( 510 'shopPage' => array(