Authored by 周少峰

修复bug

@@ -319,7 +319,7 @@ class HelperSearch @@ -319,7 +319,7 @@ class HelperSearch
319 } 319 }
320 } 320 }
321 $result['list'] = $sortList; 321 $result['list'] = $sortList;
322 - 322 +// print_r($result); exit;
323 return $result; 323 return $result;
324 } 324 }
325 325
@@ -427,6 +427,7 @@ class HelperSearch @@ -427,6 +427,7 @@ class HelperSearch
427 unset($params['brand']); 427 unset($params['brand']);
428 //设置已选中的品牌 428 //设置已选中的品牌
429 foreach ($brandIds as $key => $val) { 429 foreach ($brandIds as $key => $val) {
  430 + if (isset($brandAll[$val])) {
430 $brandParam = $brandIds; 431 $brandParam = $brandIds;
431 unset($brandParam[$key]); 432 unset($brandParam[$key]);
432 $params['brand'] = implode(',', $brandParam); 433 $params['brand'] = implode(',', $brandParam);
@@ -435,6 +436,7 @@ class HelperSearch @@ -435,6 +436,7 @@ class HelperSearch
435 'href' => self::buildUrl($params) 436 'href' => self::buildUrl($params)
436 ); 437 );
437 } 438 }
  439 + }
438 ksort($brandList); 440 ksort($brandList);
439 //品牌列表排序, 添加品牌索引 441 //品牌列表排序, 添加品牌索引
440 $index_key = array(); 442 $index_key = array();
@@ -474,7 +476,7 @@ class HelperSearch @@ -474,7 +476,7 @@ class HelperSearch
474 $result = array(); 476 $result = array();
475 if (isset($filter['size']) && !empty($filter['size'])) { 477 if (isset($filter['size']) && !empty($filter['size'])) {
476 $size = $filter['size']; 478 $size = $filter['size'];
477 - foreach ($size as $v) { 479 + foreach ($size as $k=> $v) {
478 //设置选中 480 //设置选中
479 if ($v['size_id'] == $sizeId) { 481 if ($v['size_id'] == $sizeId) {
480 self::$selected['size'] = array( 482 self::$selected['size'] = array(
@@ -482,12 +484,12 @@ class HelperSearch @@ -482,12 +484,12 @@ class HelperSearch
482 'href' => self::buildUrl($params) 484 'href' => self::buildUrl($params)
483 ); 485 );
484 } 486 }
485 -  
486 $result[] = array( 487 $result[] = array(
487 'name' => $v['size_name'], 488 'name' => $v['size_name'],
488 'href' => self::buildUrl(array_merge($params, array( 489 'href' => self::buildUrl(array_merge($params, array(
489 'size' => $v['size_id'] 490 'size' => $v['size_id']
490 ))) , 491 ))) ,
  492 + 'checked' => isset(self::$params['size']) && self::$params['size'] == $v['size_id'] ? true : false
491 ); 493 );
492 } 494 }
493 if (self::checkSearch('size')) { 495 if (self::checkSearch('size')) {
@@ -579,6 +581,7 @@ class HelperSearch @@ -579,6 +581,7 @@ class HelperSearch
579 'href' => self::buildUrl(array_merge($params, array( 581 'href' => self::buildUrl(array_merge($params, array(
580 'price' => $key 582 'price' => $key
581 ))) , 583 ))) ,
  584 + 'checked' => isset(self::$params['price']) && self::$params['price'] == $key ? true : false
582 ); 585 );
583 } 586 }
584 return $result; 587 return $result;
@@ -1213,11 +1216,9 @@ class HelperSearch @@ -1213,11 +1216,9 @@ class HelperSearch
1213 1216
1214 public static function getClassesUrl($condition) 1217 public static function getClassesUrl($condition)
1215 { 1218 {
1216 -  
1217 $condition['sales'] = 'Y'; //在销售商品分类 1219 $condition['sales'] = 'Y'; //在销售商品分类
1218 $condition['status'] = 1; //上架商品分类 1220 $condition['status'] = 1; //上架商品分类
1219 $condition['stocknumber'] = 1; //过滤掉已售罄 1221 $condition['stocknumber'] = 1; //过滤掉已售罄
1220 -  
1221 return Yohobuy::httpBuildQuery(self::getUrl('sort'), $condition); 1222 return Yohobuy::httpBuildQuery(self::getUrl('sort'), $condition);
1222 } 1223 }
1223 1224
@@ -118,7 +118,16 @@ class SearchModel @@ -118,7 +118,16 @@ class SearchModel
118 $condition['viewNum'] = $condition['viewNum'] - 1; 118 $condition['viewNum'] = $condition['viewNum'] - 1;
119 $condition = array_merge($condition, $param); 119 $condition = array_merge($condition, $param);
120 $options = array_merge($options, $option); 120 $options = array_merge($options, $option);
  121 + //调用商品分类的参数
  122 + $sortCondition = $condition;
  123 + if (isset($sortCondition['msort'])) {
  124 + unset($sortCondition['msort']);
  125 + }
  126 + if (isset($sortCondition['misort'])) {
  127 + unset($sortCondition['misort']);
  128 + }
121 $data['condition'] = $condition; 129 $data['condition'] = $condition;
  130 + $data['sortCondition'] = $sortCondition;
122 $data['options'] = $options; 131 $data['options'] = $options;
123 132
124 return $data; 133 return $data;
@@ -137,7 +146,7 @@ class SearchModel @@ -137,7 +146,7 @@ class SearchModel
137 // 组合搜索商品url 146 // 组合搜索商品url
138 $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']); 147 $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
139 // 组合搜索分类url 148 // 组合搜索分类url
140 - $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']); 149 + $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['sortCondition']);
141 // 组合搜索折扣区间url 150 // 组合搜索折扣区间url
142 $urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']); 151 $urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']);
143 // 组合搜索最新上架url 152 // 组合搜索最新上架url
@@ -164,6 +173,12 @@ class SearchModel @@ -164,6 +173,12 @@ class SearchModel
164 // 组合搜索商品url 173 // 组合搜索商品url
165 $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']); 174 $urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
166 // 组合搜索分类url 175 // 组合搜索分类url
  176 + if (isset($condition['msort'])) {
  177 + unset($condition['msort']);
  178 + }
  179 + if (isset($condition['misort'])) {
  180 + unset($condition['misort']);
  181 + }
167 $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']); 182 $urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
168 // 组合搜索店铺url 183 // 组合搜索店铺url
169 if (isset($param['keyword'])) { 184 if (isset($param['keyword'])) {