Authored by 周少峰

无搜索结果提示不一致

@@ -20,7 +20,7 @@ class HelperSearch @@ -20,7 +20,7 @@ class HelperSearch
20 //总页数 20 //总页数
21 public static $pageTotal; 21 public static $pageTotal;
22 //总记录数 22 //总记录数
23 - public static $total; 23 + public static $total = 0;
24 //接口返回搜索条件 24 //接口返回搜索条件
25 public static $filter; 25 public static $filter;
26 //选中的条件 26 //选中的条件
@@ -142,10 +142,6 @@ class HelperSearch @@ -142,10 +142,6 @@ class HelperSearch
142 } 142 }
143 //选中条件 143 //选中条件
144 $result['filters']['checkedConditions'] = self::getSelected(); 144 $result['filters']['checkedConditions'] = self::getSelected();
145 - if (empty($result['goods'])) {  
146 - $result['filters'] = array();  
147 - $result['opts'] = array();  
148 - }  
149 $result['pathNav'] = isset($options['controller']) && $options['controller'] == 'Sale' ? array() : self::$listNav; 145 $result['pathNav'] = isset($options['controller']) && $options['controller'] == 'Sale' ? array() : self::$listNav;
150 return $result; 146 return $result;
151 } 147 }
@@ -680,10 +676,6 @@ class HelperSearch @@ -680,10 +676,6 @@ class HelperSearch
680 public static function price($filter) 676 public static function price($filter)
681 { 677 {
682 $result = array(); 678 $result = array();
683 - //商品记录小于10,不显示价格区间  
684 - if (self::$total < 10) {  
685 - return $result;  
686 - }  
687 $params = self::$params; 679 $params = self::$params;
688 $priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : ''; 680 $priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
689 if (isset($params['price'])) { 681 if (isset($params['price'])) {
@@ -707,6 +699,10 @@ class HelperSearch @@ -707,6 +699,10 @@ class HelperSearch
707 'href' => self::buildUrl($params) 699 'href' => self::buildUrl($params)
708 ); 700 );
709 } 701 }
  702 + //商品记录小于10,不显示价格区间
  703 + if (self::$total < 10) {
  704 + return $result;
  705 + }
710 if (self::checkSearch('price')) { 706 if (self::checkSearch('price')) {
711 return array(); 707 return array();
712 } 708 }
@@ -1086,6 +1082,10 @@ class HelperSearch @@ -1086,6 +1082,10 @@ class HelperSearch
1086 public static function getSelected() 1082 public static function getSelected()
1087 { 1083 {
1088 $result = array(); 1084 $result = array();
  1085 + //无结果
  1086 + if (self::$total == 0 && self::$options['controller'] == 'Search') {
  1087 + return $result;
  1088 + }
1089 $data = array(); 1089 $data = array();
1090 foreach (self::$selected as $key => $val) { 1090 foreach (self::$selected as $key => $val) {
1091 $data[] = $val; 1091 $data[] = $val;
@@ -1386,6 +1386,10 @@ class HelperSearch @@ -1386,6 +1386,10 @@ class HelperSearch
1386 */ 1386 */
1387 public static function getOpts() 1387 public static function getOpts()
1388 { 1388 {
  1389 + //无结果
  1390 + if (self::$total == 0 && self::$options['controller'] == 'Search') {
  1391 + return array();
  1392 + }
1389 //排序方式 1393 //排序方式
1390 $result['sortType'] = array( self::orderDefault(),self::orderTime(),self::orderPrice(),self::orderDiscount()); 1394 $result['sortType'] = array( self::orderDefault(),self::orderTime(),self::orderPrice(),self::orderDiscount());
1391 //特殊:新品、特价、限量 1395 //特殊:新品、特价、限量