Showing
3 changed files
with
45 additions
and
5 deletions
@@ -77,15 +77,19 @@ class HelperSearch | @@ -77,15 +77,19 @@ class HelperSearch | ||
77 | //产品列表 | 77 | //产品列表 |
78 | $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array(); | 78 | $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array(); |
79 | //总页数 | 79 | //总页数 |
80 | - $result['page_total'] = isset($data['product']['page_total']) ? $data['product']['page_total'] : ''; | ||
81 | - self::$pageTotal = $result['page_total']; | ||
82 | - self::$total = $data['product']['total']; | 80 | + if (isset($data['product']['page_total'])) { |
81 | + $result['page_total'] = $data['product']['page_total']; | ||
82 | + self::$pageTotal = $result['page_total']; | ||
83 | + } | ||
84 | + if (isset($data['product']['total'])) { | ||
85 | + self::$total = $data['product']['total']; | ||
86 | + } | ||
83 | //当前页 | 87 | //当前页 |
84 | self::$page = $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : ''; | 88 | self::$page = $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : ''; |
85 | //筛选条件 | 89 | //筛选条件 |
86 | $result['filters'] = isset($data['product']['filter']) ? self::filter() : array(); | 90 | $result['filters'] = isset($data['product']['filter']) ? self::filter() : array(); |
87 | //排序方式、显示数量等其他选项 | 91 | //排序方式、显示数量等其他选项 |
88 | - $result['opts'] = isset($data['product']['filter']) ? self::getOpts() : array(); | 92 | + $result['opts'] = self::getOpts(); |
89 | //下一页 | 93 | //下一页 |
90 | if (isset($data['product']['page_total'])) { | 94 | if (isset($data['product']['page_total'])) { |
91 | $result['hasNextPage'] = self::next($data['product']['page_total']); | 95 | $result['hasNextPage'] = self::next($data['product']['page_total']); |
@@ -621,7 +625,7 @@ class HelperSearch | @@ -621,7 +625,7 @@ class HelperSearch | ||
621 | //设置已选中价格 | 625 | //设置已选中价格 |
622 | if (!empty($priceId)) { | 626 | if (!empty($priceId)) { |
623 | $price = explode(',' ,$priceId); | 627 | $price = explode(',' ,$priceId); |
624 | - $customName = self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$price[0] . '-' . (int)$price[1]; | 628 | + $customName = isset($price[1]) && $price[1] == 99999 ? '¥'.$price[0].'以上' : '¥' . intval($price[0]-1) . '-' . intval($price[1]); |
625 | $name = isset($filter['price'][$priceId]) ? $filter['price'][$priceId] : $customName; | 629 | $name = isset($filter['price'][$priceId]) ? $filter['price'][$priceId] : $customName; |
626 | self::$selected['price'] = array( | 630 | self::$selected['price'] = array( |
627 | 'name' => $name, | 631 | 'name' => $name, |
@@ -31,6 +31,7 @@ class SearchModel | @@ -31,6 +31,7 @@ class SearchModel | ||
31 | /* 过滤请求参数 */ | 31 | /* 过滤请求参数 */ |
32 | $condition = filter_input_array(INPUT_GET, array( | 32 | $condition = filter_input_array(INPUT_GET, array( |
33 | 'query' => FILTER_SANITIZE_STRING, | 33 | 'query' => FILTER_SANITIZE_STRING, |
34 | + 'keyword' => FILTER_SANITIZE_STRING, | ||
34 | 'brand' => FILTER_SANITIZE_STRING, | 35 | 'brand' => FILTER_SANITIZE_STRING, |
35 | 'sort' => FILTER_VALIDATE_INT, | 36 | 'sort' => FILTER_VALIDATE_INT, |
36 | 'msort' => FILTER_SANITIZE_STRING, | 37 | 'msort' => FILTER_SANITIZE_STRING, |
@@ -49,6 +50,10 @@ class SearchModel | @@ -49,6 +50,10 @@ class SearchModel | ||
49 | 'viewNum' => FILTER_VALIDATE_INT, | 50 | 'viewNum' => FILTER_VALIDATE_INT, |
50 | 'rowNum' => FILTER_VALIDATE_INT, | 51 | 'rowNum' => FILTER_VALIDATE_INT, |
51 | 'page' => FILTER_VALIDATE_INT), false); | 52 | 'page' => FILTER_VALIDATE_INT), false); |
53 | + //keyword=>query关键字 | ||
54 | + if (isset($condition['keyword']) && !empty($condition['keyword'])) { | ||
55 | + $condition['query'] = rawurldecode($condition['keyword']); | ||
56 | + } | ||
52 | //关键字 | 57 | //关键字 |
53 | if (isset($condition['query']) && !empty($condition['query'])) { | 58 | if (isset($condition['query']) && !empty($condition['query'])) { |
54 | $condition['query'] = rawurldecode($condition['query']); | 59 | $condition['query'] = rawurldecode($condition['query']); |
@@ -53,4 +53,35 @@ class SearchController extends WebAction | @@ -53,4 +53,35 @@ class SearchController extends WebAction | ||
53 | $this->echoJson($size); | 53 | $this->echoJson($size); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | + | ||
57 | + /** | ||
58 | + * 搜索错误页 | ||
59 | + */ | ||
60 | + public function errorAction() | ||
61 | + { | ||
62 | + $keyword = $this->get('query'); | ||
63 | + $data = array( | ||
64 | + //初始化js | ||
65 | + 'searchListPage' => true, | ||
66 | + 'search' => array( | ||
67 | + 'keyWord' => $keyword, | ||
68 | + 'searchActionUrl' => 'http:://search.yohobuy.com', | ||
69 | + 'latestWalk' => 7, | ||
70 | + 'pathNav' => Array( | ||
71 | + '0'=>array( | ||
72 | + 'href' => '/', | ||
73 | + 'name' => '首页' | ||
74 | + ), | ||
75 | + '1'=>array( | ||
76 | + 'name' => '搜索“<span id="nav_keyword">'.$keyword.'</span>”共<span id="nav_keyword_count">0</span>个结果' | ||
77 | + ) | ||
78 | + ) | ||
79 | + ) | ||
80 | + ); | ||
81 | + $this->setTitle('潮流商品搜索 | YOHO!有货'); | ||
82 | + $this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流'); | ||
83 | + $this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜'); | ||
84 | + $this->setWebNavHeader(); | ||
85 | + $this->_view->display('search', $data); | ||
86 | + } | ||
56 | } | 87 | } |
-
Please register or login to post a comment