Showing
3 changed files
with
57 additions
and
9 deletions
@@ -86,7 +86,7 @@ class HelperSearch | @@ -86,7 +86,7 @@ class HelperSearch | ||
86 | $result['filters']['brand'] = self::brand($filter, $options); | 86 | $result['filters']['brand'] = self::brand($filter, $options); |
87 | //价格 | 87 | //价格 |
88 | $result['filters']['price'] = self::price($filter); | 88 | $result['filters']['price'] = self::price($filter); |
89 | - $result['filter']['customPrice'] = self::customPrice($filter); | 89 | + $result['filters']['customPrice'] = self::customPrice($filter); |
90 | //颜色 | 90 | //颜色 |
91 | $result['filters']['color'] = self::color($filter); | 91 | $result['filters']['color'] = self::color($filter); |
92 | //尺寸 | 92 | //尺寸 |
@@ -467,9 +467,10 @@ class HelperSearch | @@ -467,9 +467,10 @@ class HelperSearch | ||
467 | }else{ | 467 | }else{ |
468 | $price = explode(',', $priceId); | 468 | $price = explode(',', $priceId); |
469 | if (count($price) == 2) { | 469 | if (count($price) == 2) { |
470 | + | ||
470 | self::$selected['price'] = array( | 471 | self::$selected['price'] = array( |
471 | 'name' => self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$price[0] . '-' . (int)$price[1], | 472 | 'name' => self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$price[0] . '-' . (int)$price[1], |
472 | - 'url' => self::buildurl($params) | 473 | + 'href' => self::buildurl($params) |
473 | ); | 474 | ); |
474 | } | 475 | } |
475 | } | 476 | } |
@@ -492,19 +493,18 @@ class HelperSearch | @@ -492,19 +493,18 @@ class HelperSearch | ||
492 | public static function customPrice($filter) { | 493 | public static function customPrice($filter) { |
493 | $params = self::$params; | 494 | $params = self::$params; |
494 | $result = array( | 495 | $result = array( |
495 | - 'customMin' => '', | ||
496 | - 'customMax' => '' | 496 | + 'min' => '', |
497 | + 'max' => '' | ||
497 | ); | 498 | ); |
498 | $priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : ''; | 499 | $priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : ''; |
499 | if (isset($params['price']) && !isset($filter['price'][$priceId]) ) { | 500 | if (isset($params['price']) && !isset($filter['price'][$priceId]) ) { |
500 | $price = explode(',', $params['price']); | 501 | $price = explode(',', $params['price']); |
501 | unset($params['price']); | 502 | unset($params['price']); |
502 | $result = array( | 503 | $result = array( |
503 | - 'customMin' => $price[0], | ||
504 | - 'customMax' => $price[1] | 504 | + 'min' => $price[0], |
505 | + 'max' => $price[1] | ||
505 | ); | 506 | ); |
506 | } | 507 | } |
507 | - print_r($result); | ||
508 | return $result; | 508 | return $result; |
509 | } | 509 | } |
510 | 510 |
@@ -60,6 +60,42 @@ class SearchModel | @@ -60,6 +60,42 @@ class SearchModel | ||
60 | } | 60 | } |
61 | 61 | ||
62 | /** | 62 | /** |
63 | + * 搜索页面获取搜索数据 | ||
64 | + * @param $condition | ||
65 | + * @param $options | ||
66 | + * @return array | ||
67 | + */ | ||
68 | + public static function searchData($condition, $options){ | ||
69 | + $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']); | ||
94 | + } | ||
95 | + return $data; | ||
96 | + | ||
97 | + } | ||
98 | + /** | ||
63 | * 根据product_sn查询产品图片信息 | 99 | * 根据product_sn查询产品图片信息 |
64 | * @param $product_sn | 100 | * @param $product_sn |
65 | * @param $options | 101 | * @param $options |
@@ -31,7 +31,7 @@ class SearchController extends WebAction | @@ -31,7 +31,7 @@ class SearchController extends WebAction | ||
31 | $condition[$key] = rawurldecode($val); | 31 | $condition[$key] = rawurldecode($val); |
32 | } | 32 | } |
33 | //关键词 | 33 | //关键词 |
34 | - $condition['query'] = 'vans'; | 34 | + $condition['query'] = '鞋'; |
35 | //性別(频道) | 35 | //性別(频道) |
36 | $gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1); | 36 | $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 ; | 37 | $gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : $gender_cookie ; |
@@ -56,6 +56,18 @@ class SearchController extends WebAction | @@ -56,6 +56,18 @@ class SearchController extends WebAction | ||
56 | $imgSize = array(235, 314); | 56 | $imgSize = array(235, 314); |
57 | $minImgSize = array(60, 80); | 57 | $minImgSize = array(60, 80); |
58 | } | 58 | } |
59 | + //自定义搜索价格 | ||
60 | + if (isset($condition['price']) || !empty($condition['price'])) { | ||
61 | + $price = explode(',', $condition['price']); | ||
62 | + if (!$price[0]) { | ||
63 | + $price[0] = 0; | ||
64 | + } | ||
65 | + if ($price[1]) { | ||
66 | + $price[1] = 99999; | ||
67 | + } | ||
68 | + $condition['price'] = implode(',', $price); | ||
69 | + } | ||
70 | + | ||
59 | //返回搜索条件 | 71 | //返回搜索条件 |
60 | $condition['needFilter'] = 1; | 72 | $condition['needFilter'] = 1; |
61 | //过滤赠品 | 73 | //过滤赠品 |
@@ -78,7 +90,7 @@ class SearchController extends WebAction | @@ -78,7 +90,7 @@ class SearchController extends WebAction | ||
78 | $params = array_filter($params); | 90 | $params = array_filter($params); |
79 | //每页记录数减1,下一页占位 | 91 | //每页记录数减1,下一页占位 |
80 | $params['viewNum'] = $params['viewNum'] - 1; | 92 | $params['viewNum'] = $params['viewNum'] - 1; |
81 | - $searchData = SearchModel::getSearchData($params,$options); | 93 | + $searchData = SearchModel::searchData($params,$options); |
82 | $cate = array('boys','girls','kids','lifestyle'); | 94 | $cate = array('boys','girls','kids','lifestyle'); |
83 | $this->setWebNavHeader($cate[$gender-1]); | 95 | $this->setWebNavHeader($cate[$gender-1]); |
84 | $data = array( | 96 | $data = array( |
-
Please register or login to post a comment