1
|
<?php
|
1
|
<?php
|
2
|
|
2
|
|
3
|
namespace Plugin;
|
3
|
namespace Plugin;
|
4
|
-use Plugin\Images;
|
4
|
+use Plugin\Paging;
|
5
|
/**
|
5
|
/**
|
6
|
* 搜索辅助类
|
6
|
* 搜索辅助类
|
7
|
*/
|
7
|
*/
|
|
@@ -10,11 +10,10 @@ class HelperSearch |
|
@@ -10,11 +10,10 @@ class HelperSearch |
10
|
/**
|
10
|
/**
|
11
|
* 请求时用的所有参数
|
11
|
* 请求时用的所有参数
|
12
|
*/
|
12
|
*/
|
13
|
- private static $params = array();
|
13
|
+ public static $params = array();
|
14
|
|
14
|
|
15
|
- //当前页面
|
|
|
16
|
- private static $current_url = '';
|
|
|
17
|
- private static $page = 1;
|
15
|
+ //当前页
|
|
|
16
|
+ public static $page = 1;
|
18
|
|
17
|
|
19
|
/**
|
18
|
/**
|
20
|
* 选中的条件
|
19
|
* 选中的条件
|
|
@@ -25,132 +24,101 @@ class HelperSearch |
|
@@ -25,132 +24,101 @@ class HelperSearch |
25
|
* list分类面包屑
|
24
|
* list分类面包屑
|
26
|
* @var array
|
25
|
* @var array
|
27
|
*/
|
26
|
*/
|
28
|
- public static $listnav = array(
|
|
|
29
|
- array(
|
27
|
+ public static $listnav = array();
|
|
|
28
|
+
|
|
|
29
|
+
|
|
|
30
|
+ //设置导航
|
|
|
31
|
+ private static function setListNav($option = array())
|
|
|
32
|
+ {
|
|
|
33
|
+ $cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
|
|
|
34
|
+ if (isset($option['brandName']) && !empty($option['brandName'])) {
|
|
|
35
|
+ $initNav = $option['brandName'];
|
|
|
36
|
+ }else{
|
|
|
37
|
+ $initNav = '列表';
|
|
|
38
|
+ }
|
|
|
39
|
+ self::$listnav[0] = array(
|
30
|
'href' => '',
|
40
|
'href' => '',
|
31
|
- 'name' => '首页'
|
|
|
32
|
- ),
|
|
|
33
|
- array(
|
41
|
+ 'name' => $cookieChannel
|
|
|
42
|
+ );
|
|
|
43
|
+ self::$listnav[1] = array(
|
34
|
'href' => '',
|
44
|
'href' => '',
|
35
|
- 'name' => '列表'
|
|
|
36
|
- )
|
45
|
+ 'name' => $initNav
|
37
|
);
|
46
|
);
|
38
|
-
|
47
|
+ }
|
39
|
/**
|
48
|
/**
|
40
|
* 组织搜索模板数据
|
49
|
* 组织搜索模板数据
|
41
|
* @param array $data
|
50
|
* @param array $data
|
42
|
* @param array $options
|
51
|
* @param array $options
|
43
|
* @return array
|
52
|
* @return array
|
44
|
*/
|
53
|
*/
|
45
|
- public static function getList($data = array() , $options = array()) {
|
|
|
46
|
- if (empty($data)) {
|
|
|
47
|
- return array();
|
|
|
48
|
- }
|
54
|
+ public static function getList($data = array() , $options = array())
|
|
|
55
|
+ {
|
|
|
56
|
+ $result = array();
|
49
|
self::$params = $_GET;
|
57
|
self::$params = $_GET;
|
50
|
unset(self::$params['/']);
|
58
|
unset(self::$params['/']);
|
51
|
unset(self::$params['page']);
|
59
|
unset(self::$params['page']);
|
52
|
unset(self::$params['/sale']);
|
60
|
unset(self::$params['/sale']);
|
53
|
unset(self::$params['sale']);
|
61
|
unset(self::$params['sale']);
|
54
|
- $result = array();
|
|
|
55
|
- if (!isset($data['data']) || !isset($data['data']['product_list']) || !is_array($data['data']['product_list'])) {
|
|
|
56
|
- return array();
|
|
|
57
|
- }
|
|
|
58
|
- $result['product_list'] = self::getProductList($data['data']['product_list'], $options['imgSize'], $options['minImgSize'], $options['gender']);
|
62
|
+ $filter = $data['data']['filter'];
|
|
|
63
|
+ //产品列表
|
|
|
64
|
+ $result['goods'] = self::getProductList($data['data']['product_list'], $options['imgSize']);
|
|
|
65
|
+ //总页数
|
59
|
$result['page_total'] = $data['data']['page_total'];
|
66
|
$result['page_total'] = $data['data']['page_total'];
|
60
|
- $result['total'] = $data['data']['total'];
|
67
|
+ //当前页
|
61
|
$result['page'] = $data['data']['page'];
|
68
|
$result['page'] = $data['data']['page'];
|
62
|
- //设置当前页
|
|
|
63
|
self::$page = $result['page'];
|
69
|
self::$page = $result['page'];
|
64
|
- //搜索条件
|
|
|
65
|
- if (isset($data['data']['filter']) && !empty($data['data']['filter'])) {
|
|
|
66
|
- $filter = $data['data']['filter'];
|
|
|
67
|
- $result['filter']['left_sort'] = isset($filter['minsort']) ? self::minsort($filter['minsort']) : array();
|
|
|
68
|
- $result['filter']['group_sort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array();
|
|
|
69
|
- $result['filter']['size'] = self::size($filter);
|
|
|
70
|
- $result['filter']['color'] = self::color($filter);
|
|
|
71
|
- $result['filter']['price'] = self::price($filter);
|
|
|
72
|
- $result['filter']['brand'] = self::brand($filter);
|
|
|
73
|
- $result['filter']['parameters'] = self::standard($filter);
|
|
|
74
|
- $result['filter']['rowNum4'] = self::rowNum();
|
|
|
75
|
- $result['filter']['rowNum6'] = self::rowNum(6);
|
|
|
76
|
- $result['filter']['viewNum'] = self::viewNum();
|
|
|
77
|
- $result['filter']['priceSubmit'] = self::priceSubmit();
|
|
|
78
|
- $result['filter']['gender'] = self::gender($filter);
|
|
|
79
|
- $result['filter']['selected'] = self::getSelected();
|
|
|
80
|
- $result['filter']['checks'] = array(self::isnew(),self::specialoffer(),self::limited());
|
|
|
81
|
- $result['filter']['sortType'] = array( self::orderDefault(),self::orderTime(),self::orderPrice(),self::orderDiscount());
|
|
|
82
|
- $result['filter']['clear'] =self::current();
|
|
|
83
|
- $result['filter']['next'] = self::next($data['data']['page_total'],$data['data']['filter']);
|
|
|
84
|
- $result['filter']['listnav'] = self::$listnav;
|
|
|
85
|
- $result['filter']['discount'] = self::getDiscount($filter['discount']);
|
|
|
86
|
- $result['filter']['recent'] = self::recentShelve($filter['recent']);
|
|
|
87
|
- $result['filter']['seniorChose'] = self::seniorChose($filter);
|
|
|
88
|
- }
|
|
|
89
|
- return $result;
|
|
|
90
|
- }
|
|
|
91
|
-
|
|
|
92
|
- /**
|
|
|
93
|
- * 组织列表模板数据
|
|
|
94
|
- *
|
|
|
95
|
- */
|
|
|
96
|
- public static function getTemplateData($result, $options){
|
|
|
97
|
- //模板数据
|
|
|
98
|
- $data = array(
|
|
|
99
|
- 'brandBanner' => array(),
|
|
|
100
|
- 'pathNav' => $result['filter']['listnav'],
|
|
|
101
|
- 'shopEntry' => array(),
|
|
|
102
|
- 'filters' => array(
|
|
|
103
|
- 'checkedConditions' => array(
|
|
|
104
|
- 'conditions' => $result['filter']['selected'],
|
|
|
105
|
- 'clearUrl' => $result['filter']['clear']
|
|
|
106
|
- ),
|
|
|
107
|
- 'channel' => $result['filter']['gender'],
|
|
|
108
|
- 'sort' => array() ,
|
|
|
109
|
- 'brand' => $result['filter']['brand'],
|
|
|
110
|
- 'price' => $result['filter']['price'],
|
|
|
111
|
- 'color' => $result['filter']['color'],
|
|
|
112
|
- 'size' => $result['filter']['size'],
|
|
|
113
|
- 'seniorChose' => $result['filter']['seniorChose']
|
|
|
114
|
- ),
|
|
|
115
|
- 'opts' => array(
|
|
|
116
|
- 'sortType' => $result['filter']['sortType'],
|
|
|
117
|
- 'checks' => $result['filter']['checks'],
|
|
|
118
|
- 'fivePerLine' => true,
|
|
|
119
|
- 'sixPerLineHref' => '',
|
|
|
120
|
- 'countPerPage' => $options['viewNum'],
|
|
|
121
|
- 'pageCounts' => $result['filter']['viewNum'],
|
|
|
122
|
- 'curPage' => $result['page'],
|
|
|
123
|
- 'pageCount' => $result['page_total'],
|
|
|
124
|
- 'nextHref' => $result['filter']['next']
|
|
|
125
|
- ),
|
|
|
126
|
- 'hasNextPage' => array(
|
|
|
127
|
- 'href' => $result['filter']['next'],
|
70
|
+ //清除选中
|
|
|
71
|
+ $result['filters']['checkedConditions']['clearUrl'] = self::current();
|
|
|
72
|
+ //频道
|
|
|
73
|
+ $result['filters']['channel'] = self::gender($filter);
|
|
|
74
|
+ //分类
|
|
|
75
|
+ $result['filters']['sort'] = array();
|
|
|
76
|
+ //品牌
|
|
|
77
|
+ $result['filters']['brand'] = self::brand($filter);
|
|
|
78
|
+ //价格
|
|
|
79
|
+ $result['filters']['price'] = self::price($filter);
|
|
|
80
|
+ //颜色
|
|
|
81
|
+ $result['filters']['color'] = self::color($filter);
|
|
|
82
|
+ //尺寸
|
|
|
83
|
+ $result['filters']['size'] = self::size($filter);
|
|
|
84
|
+ //高级选项
|
|
|
85
|
+ $result['filters']['seniorChose'] = self::seniorChose($filter);
|
|
|
86
|
+ //排序方式
|
|
|
87
|
+ $result['opts']['sortType'] = array( self::orderDefault(),self::orderTime(),self::orderPrice(),self::orderDiscount());
|
|
|
88
|
+ //特殊:新品、特价、限量
|
|
|
89
|
+ $result['opts']['checks'] = array(self::isnew(),self::specialoffer(),self::limited());
|
|
|
90
|
+ //每行显示5个产品
|
|
|
91
|
+ $result['opts']['fivePerLine'] = true;
|
|
|
92
|
+ //每行显示6个产品
|
|
|
93
|
+ $result['opts']['sixPerLineHref'] = true;
|
|
|
94
|
+ //每页显示的数量
|
|
|
95
|
+ $result['opts']['countPerPage'] = $options['viewNum'];
|
|
|
96
|
+ //可选每页显示数量
|
|
|
97
|
+ $result['opts']['pageCounts'] = self::viewNum();
|
|
|
98
|
+ $result['opts']['curPage'] = self::$page;
|
|
|
99
|
+ $result['opts']['pageCount'] = $data['data']['page_total'];
|
|
|
100
|
+ $result['opts']['nextHref'] = self::next($data['data']['page_total'],$data['data']['filter']);
|
|
|
101
|
+ $result['hasNextPage'] = array(
|
|
|
102
|
+ 'href' => self::next($data['data']['page_total'],$data['data']['filter']),
|
128
|
'src' => 'http://img10.static.yhbimg.com/product/2014/01/15/11/01fa01614784f6239760f1b749663016f1.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
|
103
|
'src' => 'http://img10.static.yhbimg.com/product/2014/01/15/11/01fa01614784f6239760f1b749663016f1.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
|
129
|
- ),
|
|
|
130
|
- 'goods' => $result['product_list'],
|
|
|
131
|
- 'leftContent' => array(
|
|
|
132
|
- array(
|
|
|
133
|
- 'allSort' => array(
|
|
|
134
|
- //'updateNum' => $result['filter']['group_sort']['all']['num'],
|
|
|
135
|
- 'list' => $result['filter']['group_sort']['list']
|
|
|
136
|
- )
|
|
|
137
|
- ),
|
|
|
138
|
- array(
|
|
|
139
|
- 'advNav' => array()
|
|
|
140
|
- ),
|
|
|
141
|
- array(
|
|
|
142
|
- 'advPic' => array()
|
|
|
143
|
- ),
|
|
|
144
|
- array(
|
|
|
145
|
- 'newSales' => $result['filter']['recent']
|
|
|
146
|
- ),
|
|
|
147
|
- array('allDiscount' => $result['filter']['discount'])
|
|
|
148
|
- ),
|
|
|
149
|
- 'totalCount' => $result['total'],
|
|
|
150
|
-
|
|
|
151
|
);
|
104
|
);
|
152
|
- return $data;
|
105
|
+ //分类
|
|
|
106
|
+ $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array();
|
|
|
107
|
+ //一周新品上架
|
|
|
108
|
+ $result['leftContent'][]['newSales'] = self::recentShelve($filter['recent']);
|
|
|
109
|
+ //全部折扣
|
|
|
110
|
+ $result['leftContent'][]['allDiscount'] = self::getDiscount($filter['discount']);
|
|
|
111
|
+ //总记录数
|
|
|
112
|
+ $result['totalCount'] = $data['data']['total'];
|
|
|
113
|
+ //分页
|
|
|
114
|
+ $result['pager'] = self::pager($result['totalCount'],$options['viewNum']);
|
|
|
115
|
+ //echo $result['pager']; exit;
|
|
|
116
|
+ //选中条件
|
|
|
117
|
+ $result['filters']['checkedConditions']['conditions'] = self::getSelected();
|
|
|
118
|
+ $result['pathNav'] = self::$listnav;
|
|
|
119
|
+ return $result;
|
153
|
}
|
120
|
}
|
|
|
121
|
+
|
154
|
/**
|
122
|
/**
|
155
|
* TODO 组织商品列表信息
|
123
|
* TODO 组织商品列表信息
|
156
|
* @param $product 接口返回商品列表
|
124
|
* @param $product 接口返回商品列表
|
|
@@ -158,7 +126,7 @@ class HelperSearch |
|
@@ -158,7 +126,7 @@ class HelperSearch |
158
|
* @return array
|
126
|
* @return array
|
159
|
*/
|
127
|
*/
|
160
|
public static function getProductList($product,$imgSize){
|
128
|
public static function getProductList($product,$imgSize){
|
161
|
- $result = array();
|
129
|
+ $goods = array();
|
162
|
foreach($product as $key => $val){
|
130
|
foreach($product as $key => $val){
|
163
|
//NEW
|
131
|
//NEW
|
164
|
$isNew = $val['is_new'] == 'Y' ? true : false;
|
132
|
$isNew = $val['is_new'] == 'Y' ? true : false;
|
|
@@ -171,14 +139,13 @@ class HelperSearch |
|
@@ -171,14 +139,13 @@ class HelperSearch |
171
|
//再到着
|
139
|
//再到着
|
172
|
//年终大促
|
140
|
//年终大促
|
173
|
// 年中大促
|
141
|
// 年中大促
|
174
|
-
|
|
|
175
|
foreach($val['goods_list'] as $k => $v){
|
142
|
foreach($val['goods_list'] as $k => $v){
|
176
|
$goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']);
|
143
|
$goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']);
|
177
|
}
|
144
|
}
|
178
|
if (!empty($val['default_images'])) {
|
145
|
if (!empty($val['default_images'])) {
|
179
|
$val['default_images'] = Images::getImageUrl($val['default_images'],$imgSize[0],$imgSize[1]);
|
146
|
$val['default_images'] = Images::getImageUrl($val['default_images'],$imgSize[0],$imgSize[1]);
|
180
|
}
|
147
|
}
|
181
|
- $result[] = array(
|
148
|
+ $goods[] = array(
|
182
|
'tags' => array(
|
149
|
'tags' => array(
|
183
|
'isNew' => $isNew,
|
150
|
'isNew' => $isNew,
|
184
|
'isLimit' => $isLimit
|
151
|
'isLimit' => $isLimit
|
|
@@ -192,7 +159,7 @@ class HelperSearch |
|
@@ -192,7 +159,7 @@ class HelperSearch |
192
|
'skn' => $val['product_skn']
|
159
|
'skn' => $val['product_skn']
|
193
|
);
|
160
|
);
|
194
|
}
|
161
|
}
|
195
|
- return $result;
|
162
|
+ return $goods;
|
196
|
}
|
163
|
}
|
197
|
/**
|
164
|
/**
|
198
|
* 版型等其它筛选项
|
165
|
* 版型等其它筛选项
|
|
@@ -284,6 +251,7 @@ class HelperSearch |
|
@@ -284,6 +251,7 @@ class HelperSearch |
284
|
* @return array
|
251
|
* @return array
|
285
|
*/
|
252
|
*/
|
286
|
public static function groupSort($sort, $option = array()) {
|
253
|
public static function groupSort($sort, $option = array()) {
|
|
|
254
|
+ self::setListNav();
|
287
|
$params = self::$params;
|
255
|
$params = self::$params;
|
288
|
$gender = isset($params['gender']) ? $params['gender'] : '';
|
256
|
$gender = isset($params['gender']) ? $params['gender'] : '';
|
289
|
|
257
|
|
|
@@ -385,16 +353,18 @@ class HelperSearch |
|
@@ -385,16 +353,18 @@ class HelperSearch |
385
|
/**
|
353
|
/**
|
386
|
* 品牌,可以多选
|
354
|
* 品牌,可以多选
|
387
|
* @param array $brand
|
355
|
* @param array $brand
|
|
|
356
|
+ * @param array $options
|
388
|
* @return array
|
357
|
* @return array
|
389
|
*/
|
358
|
*/
|
390
|
- public static function brand($filter) {
|
359
|
+ public static function brand($filter, $options = array()) {
|
|
|
360
|
+ if (isset($options['brandName'])) {
|
|
|
361
|
+ return array();
|
|
|
362
|
+ }
|
391
|
$params = self::$params;
|
363
|
$params = self::$params;
|
392
|
$brand_ids = isset($params['brand']) && !empty($params['brand']) ? explode(',', $params['brand']) : array();
|
364
|
$brand_ids = isset($params['brand']) && !empty($params['brand']) ? explode(',', $params['brand']) : array();
|
393
|
-
|
|
|
394
|
if (isset($params['brand'])) {
|
365
|
if (isset($params['brand'])) {
|
395
|
unset($params['brand']);
|
366
|
unset($params['brand']);
|
396
|
}
|
367
|
}
|
397
|
-
|
|
|
398
|
$result = array(
|
368
|
$result = array(
|
399
|
'default' => array() ,
|
369
|
'default' => array() ,
|
400
|
'brandIndex' => array(
|
370
|
'brandIndex' => array(
|
|
@@ -412,14 +382,11 @@ class HelperSearch |
|
@@ -412,14 +382,11 @@ class HelperSearch |
412
|
'U~Z' => array() ,
|
382
|
'U~Z' => array() ,
|
413
|
)
|
383
|
)
|
414
|
);
|
384
|
);
|
415
|
-
|
|
|
416
|
$brand_keys = array_reverse(array_keys($result['list']));
|
385
|
$brand_keys = array_reverse(array_keys($result['list']));
|
417
|
if (isset($filter['brand']) && !empty($filter['brand'])) {
|
386
|
if (isset($filter['brand']) && !empty($filter['brand'])) {
|
418
|
-
|
|
|
419
|
//有商品结果时
|
387
|
//有商品结果时
|
420
|
$brand = $filter['brand'];
|
388
|
$brand = $filter['brand'];
|
421
|
foreach ($brand as $v) {
|
389
|
foreach ($brand as $v) {
|
422
|
-
|
|
|
423
|
if (!isset($v['brand_alif']) && isset($v['brand_name_en'])) {
|
390
|
if (!isset($v['brand_alif']) && isset($v['brand_name_en'])) {
|
424
|
$v['brand_alif'] = substr($v['brand_name_en'], 0, 1);
|
391
|
$v['brand_alif'] = substr($v['brand_name_en'], 0, 1);
|
425
|
}
|
392
|
}
|
|
@@ -429,7 +396,6 @@ class HelperSearch |
|
@@ -429,7 +396,6 @@ class HelperSearch |
429
|
if (!isset($v['brand_domain'])) {
|
396
|
if (!isset($v['brand_domain'])) {
|
430
|
$v['brand_domain'] = '';
|
397
|
$v['brand_domain'] = '';
|
431
|
}
|
398
|
}
|
432
|
-
|
|
|
433
|
//选中的筛选条件
|
399
|
//选中的筛选条件
|
434
|
if (in_array($v['id'], $brand_ids)) {
|
400
|
if (in_array($v['id'], $brand_ids)) {
|
435
|
$selected_brand = explode(',', self::$params['brand']);
|
401
|
$selected_brand = explode(',', self::$params['brand']);
|
|
@@ -442,9 +408,7 @@ class HelperSearch |
|
@@ -442,9 +408,7 @@ class HelperSearch |
442
|
'href' => self::buildurl($selected_params)
|
408
|
'href' => self::buildurl($selected_params)
|
443
|
);
|
409
|
);
|
444
|
}
|
410
|
}
|
445
|
-
|
|
|
446
|
$selected_brand = isset(self::$params['brand']) && !empty(self::$params['brand']) ? explode(',', self::$params['brand']) : array();
|
411
|
$selected_brand = isset(self::$params['brand']) && !empty(self::$params['brand']) ? explode(',', self::$params['brand']) : array();
|
447
|
-
|
|
|
448
|
if (empty($selected_brand)) {
|
412
|
if (empty($selected_brand)) {
|
449
|
$url = self::buildurl(array_merge($params, array(
|
413
|
$url = self::buildurl(array_merge($params, array(
|
450
|
'brand' => $v['id']
|
414
|
'brand' => $v['id']
|
|
@@ -463,7 +427,6 @@ class HelperSearch |
|
@@ -463,7 +427,6 @@ class HelperSearch |
463
|
'brand' => implode(',', $selected_brand)
|
427
|
'brand' => implode(',', $selected_brand)
|
464
|
)));
|
428
|
)));
|
465
|
}
|
429
|
}
|
466
|
-
|
|
|
467
|
$this_brand = array(
|
430
|
$this_brand = array(
|
468
|
'brand_id' => $v['id'],
|
431
|
'brand_id' => $v['id'],
|
469
|
'name' => $v['brand_name'],
|
432
|
'name' => $v['brand_name'],
|
|
@@ -471,7 +434,6 @@ class HelperSearch |
|
@@ -471,7 +434,6 @@ class HelperSearch |
471
|
'href' => $url,
|
434
|
'href' => $url,
|
472
|
'active' => in_array($v['id'], $brand_ids) ? true : false
|
435
|
'active' => in_array($v['id'], $brand_ids) ? true : false
|
473
|
);
|
436
|
);
|
474
|
-
|
|
|
475
|
if (count($result['default']) < 10) {
|
437
|
if (count($result['default']) < 10) {
|
476
|
$result['default'][] = $this_brand;
|
438
|
$result['default'][] = $this_brand;
|
477
|
}
|
439
|
}
|
|
@@ -493,11 +455,9 @@ class HelperSearch |
|
@@ -493,11 +455,9 @@ class HelperSearch |
493
|
}
|
455
|
}
|
494
|
}
|
456
|
}
|
495
|
else if (isset($filter['paramNames']) && isset($filter['paramNames']['brand'])) {
|
457
|
else if (isset($filter['paramNames']) && isset($filter['paramNames']['brand'])) {
|
496
|
-
|
|
|
497
|
//无商品结果时且选择了品牌
|
458
|
//无商品结果时且选择了品牌
|
498
|
$brand = $filter['paramNames']['brand'];
|
459
|
$brand = $filter['paramNames']['brand'];
|
499
|
foreach ($brand as $v) {
|
460
|
foreach ($brand as $v) {
|
500
|
-
|
|
|
501
|
//选中的筛选条件
|
461
|
//选中的筛选条件
|
502
|
if (in_array($v['id'], $brand_ids)) {
|
462
|
if (in_array($v['id'], $brand_ids)) {
|
503
|
$selected_brand = explode(',', self::$params['brand']);
|
463
|
$selected_brand = explode(',', self::$params['brand']);
|
|
@@ -764,7 +724,8 @@ class HelperSearch |
|
@@ -764,7 +724,8 @@ class HelperSearch |
764
|
/**
|
724
|
/**
|
765
|
* 高级选项
|
725
|
* 高级选项
|
766
|
*/
|
726
|
*/
|
767
|
- public static function seniorChose($filter){
|
727
|
+ public static function seniorChose($filter)
|
|
|
728
|
+ {
|
768
|
$style = self::style($filter);
|
729
|
$style = self::style($filter);
|
769
|
$other = self::standard($filter);
|
730
|
$other = self::standard($filter);
|
770
|
$result = array_merge($style,$other);
|
731
|
$result = array_merge($style,$other);
|
|
@@ -774,9 +735,9 @@ class HelperSearch |
|
@@ -774,9 +735,9 @@ class HelperSearch |
774
|
/**
|
735
|
/**
|
775
|
* 每页显示数量
|
736
|
* 每页显示数量
|
776
|
*/
|
737
|
*/
|
777
|
- public static function viewNum() {
|
738
|
+ public static function viewNum()
|
|
|
739
|
+ {
|
778
|
$params = self::$params;
|
740
|
$params = self::$params;
|
779
|
-
|
|
|
780
|
$view_num = array(
|
741
|
$view_num = array(
|
781
|
60,
|
742
|
60,
|
782
|
100,
|
743
|
100,
|
|
@@ -797,7 +758,8 @@ class HelperSearch |
|
@@ -797,7 +758,8 @@ class HelperSearch |
797
|
/**
|
758
|
/**
|
798
|
* 显示行数
|
759
|
* 显示行数
|
799
|
*/
|
760
|
*/
|
800
|
- public static function rowNum($num = 5) {
|
761
|
+ public static function rowNum($num = 5)
|
|
|
762
|
+ {
|
801
|
$params = self::$params;
|
763
|
$params = self::$params;
|
802
|
|
764
|
|
803
|
$params['rowNum'] = $num;
|
765
|
$params['rowNum'] = $num;
|
|
@@ -808,7 +770,8 @@ class HelperSearch |
|
@@ -808,7 +770,8 @@ class HelperSearch |
808
|
/**
|
770
|
/**
|
809
|
* 是否特价
|
771
|
* 是否特价
|
810
|
*/
|
772
|
*/
|
811
|
- public static function specialoffer() {
|
773
|
+ public static function specialoffer()
|
|
|
774
|
+ {
|
812
|
$params = self::$params;
|
775
|
$params = self::$params;
|
813
|
if (isset($params['specialoffer']) && !empty($params['specialoffer'])) {
|
776
|
if (isset($params['specialoffer']) && !empty($params['specialoffer'])) {
|
814
|
unset($params['specialoffer']);
|
777
|
unset($params['specialoffer']);
|
|
@@ -829,7 +792,8 @@ class HelperSearch |
|
@@ -829,7 +792,8 @@ class HelperSearch |
829
|
/**
|
792
|
/**
|
830
|
* 是否限量
|
793
|
* 是否限量
|
831
|
*/
|
794
|
*/
|
832
|
- public static function limited() {
|
795
|
+ public static function limited()
|
|
|
796
|
+ {
|
833
|
$params = self::$params;
|
797
|
$params = self::$params;
|
834
|
if (isset($params['limited']) && !empty($params['limited'])) {
|
798
|
if (isset($params['limited']) && !empty($params['limited'])) {
|
835
|
unset($params['limited']);
|
799
|
unset($params['limited']);
|
|
@@ -849,7 +813,8 @@ class HelperSearch |
|
@@ -849,7 +813,8 @@ class HelperSearch |
849
|
/**
|
813
|
/**
|
850
|
* 是否新品
|
814
|
* 是否新品
|
851
|
*/
|
815
|
*/
|
852
|
- public static function isnew() {
|
816
|
+ public static function isnew()
|
|
|
817
|
+ {
|
853
|
$params = self::$params;
|
818
|
$params = self::$params;
|
854
|
|
819
|
|
855
|
if (isset($params['isNew']) && !empty($params['isNew'])) {
|
820
|
if (isset($params['isNew']) && !empty($params['isNew'])) {
|
|
@@ -870,7 +835,8 @@ class HelperSearch |
|
@@ -870,7 +835,8 @@ class HelperSearch |
870
|
/**
|
835
|
/**
|
871
|
* 排序是否最新
|
836
|
* 排序是否最新
|
872
|
*/
|
837
|
*/
|
873
|
- public static function orderTime() {
|
838
|
+ public static function orderTime()
|
|
|
839
|
+ {
|
874
|
$params = self::$params;
|
840
|
$params = self::$params;
|
875
|
if (isset($params['order'])) {
|
841
|
if (isset($params['order'])) {
|
876
|
unset($params['order']);
|
842
|
unset($params['order']);
|
|
@@ -888,7 +854,8 @@ class HelperSearch |
|
@@ -888,7 +854,8 @@ class HelperSearch |
888
|
/**
|
854
|
/**
|
889
|
* 排序是否默认
|
855
|
* 排序是否默认
|
890
|
*/
|
856
|
*/
|
891
|
- public static function orderDefault() {
|
857
|
+ public static function orderDefault()
|
|
|
858
|
+ {
|
892
|
$params = self::$params;
|
859
|
$params = self::$params;
|
893
|
if (isset($params['order'])) {
|
860
|
if (isset($params['order'])) {
|
894
|
unset($params['order']);
|
861
|
unset($params['order']);
|
|
@@ -904,7 +871,8 @@ class HelperSearch |
|
@@ -904,7 +871,8 @@ class HelperSearch |
904
|
/**
|
871
|
/**
|
905
|
* 价格排序
|
872
|
* 价格排序
|
906
|
*/
|
873
|
*/
|
907
|
- public static function orderPrice() {
|
874
|
+ public static function orderPrice()
|
|
|
875
|
+ {
|
908
|
$params = self::$params;
|
876
|
$params = self::$params;
|
909
|
if (isset($params['order'])) {
|
877
|
if (isset($params['order'])) {
|
910
|
unset($params['order']);
|
878
|
unset($params['order']);
|
|
@@ -946,7 +914,8 @@ class HelperSearch |
|
@@ -946,7 +914,8 @@ class HelperSearch |
946
|
/**
|
914
|
/**
|
947
|
* 折扣排序
|
915
|
* 折扣排序
|
948
|
*/
|
916
|
*/
|
949
|
- public static function orderDiscount() {
|
917
|
+ public static function orderDiscount()
|
|
|
918
|
+ {
|
950
|
$params = self::$params;
|
919
|
$params = self::$params;
|
951
|
if (isset($params['order'])) {
|
920
|
if (isset($params['order'])) {
|
952
|
unset($params['order']);
|
921
|
unset($params['order']);
|
|
@@ -988,7 +957,8 @@ class HelperSearch |
|
@@ -988,7 +957,8 @@ class HelperSearch |
988
|
/**
|
957
|
/**
|
989
|
* 获取自定义价格要提交的地址
|
958
|
* 获取自定义价格要提交的地址
|
990
|
*/
|
959
|
*/
|
991
|
- public static function priceSubmit() {
|
960
|
+ public static function priceSubmit()
|
|
|
961
|
+ {
|
992
|
$params = self::$params;
|
962
|
$params = self::$params;
|
993
|
$price = array();
|
963
|
$price = array();
|
994
|
if (isset($params['price'])) {
|
964
|
if (isset($params['price'])) {
|
|
@@ -1030,7 +1000,8 @@ class HelperSearch |
|
@@ -1030,7 +1000,8 @@ class HelperSearch |
1030
|
* @param array $params
|
1000
|
* @param array $params
|
1031
|
* @return string
|
1001
|
* @return string
|
1032
|
*/
|
1002
|
*/
|
1033
|
- private static function buildurl($params) {
|
1003
|
+ private static function buildurl($params)
|
|
|
1004
|
+ {
|
1034
|
if (empty($params)) {
|
1005
|
if (empty($params)) {
|
1035
|
return self::current();
|
1006
|
return self::current();
|
1036
|
}
|
1007
|
}
|
|
@@ -1054,7 +1025,8 @@ class HelperSearch |
|
@@ -1054,7 +1025,8 @@ class HelperSearch |
1054
|
/**
|
1025
|
/**
|
1055
|
* 获取选中的条件
|
1026
|
* 获取选中的条件
|
1056
|
*/
|
1027
|
*/
|
1057
|
- public static function getSelected() {
|
1028
|
+ public static function getSelected()
|
|
|
1029
|
+ {
|
1058
|
$result = array();
|
1030
|
$result = array();
|
1059
|
$is_array_key = array(
|
1031
|
$is_array_key = array(
|
1060
|
'brand',
|
1032
|
'brand',
|
|
@@ -1078,7 +1050,8 @@ class HelperSearch |
|
@@ -1078,7 +1050,8 @@ class HelperSearch |
1078
|
* @param array $list
|
1050
|
* @param array $list
|
1079
|
* @return array
|
1051
|
* @return array
|
1080
|
*/
|
1052
|
*/
|
1081
|
- public static function getDiscount(array $list = array()) {
|
1053
|
+ public static function getDiscount(array $list = array())
|
|
|
1054
|
+ {
|
1082
|
$params = self::$params;
|
1055
|
$params = self::$params;
|
1083
|
|
1056
|
|
1084
|
if (empty($list)) {
|
1057
|
if (empty($list)) {
|
|
@@ -1105,7 +1078,7 @@ class HelperSearch |
|
@@ -1105,7 +1078,7 @@ class HelperSearch |
1105
|
}
|
1078
|
}
|
1106
|
$result = array(
|
1079
|
$result = array(
|
1107
|
//'updateNum' => $total,
|
1080
|
//'updateNum' => $total,
|
1108
|
- 'list' => $list
|
1081
|
+ 'list' => array_values($list)
|
1109
|
);
|
1082
|
);
|
1110
|
return $result;
|
1083
|
return $result;
|
1111
|
}
|
1084
|
}
|
|
@@ -1113,7 +1086,8 @@ class HelperSearch |
|
@@ -1113,7 +1086,8 @@ class HelperSearch |
1113
|
/**
|
1086
|
/**
|
1114
|
* 最新上架
|
1087
|
* 最新上架
|
1115
|
*/
|
1088
|
*/
|
1116
|
- public static function recentShelve($list = array()){
|
1089
|
+ public static function recentShelve($list = array())
|
|
|
1090
|
+ {
|
1117
|
if (empty($list)) {
|
1091
|
if (empty($list)) {
|
1118
|
return array();
|
1092
|
return array();
|
1119
|
}
|
1093
|
}
|
|
@@ -1153,11 +1127,7 @@ class HelperSearch |
|
@@ -1153,11 +1127,7 @@ class HelperSearch |
1153
|
*/
|
1127
|
*/
|
1154
|
public static function current(){
|
1128
|
public static function current(){
|
1155
|
$url = explode('?', $_SERVER['REQUEST_URI']);
|
1129
|
$url = explode('?', $_SERVER['REQUEST_URI']);
|
1156
|
- self::$current_url = $url[0];
|
|
|
1157
|
- self::$listnav[0] = array(
|
|
|
1158
|
- 'href' => '$url[0]',
|
|
|
1159
|
- 'name' => '首页'
|
|
|
1160
|
- );
|
1130
|
+ self::$listnav[0]['href'] = $url[0];
|
1161
|
return $url[0];
|
1131
|
return $url[0];
|
1162
|
}
|
1132
|
}
|
1163
|
/**
|
1133
|
/**
|
|
@@ -1175,7 +1145,7 @@ class HelperSearch |
|
@@ -1175,7 +1145,7 @@ class HelperSearch |
1175
|
}
|
1145
|
}
|
1176
|
|
1146
|
|
1177
|
/**
|
1147
|
/**
|
1178
|
- * 组织产品
|
1148
|
+ * 组织产品的图片
|
1179
|
* @param $product
|
1149
|
* @param $product
|
1180
|
* @param $options
|
1150
|
* @param $options
|
1181
|
* @return array
|
1151
|
* @return array
|
|
@@ -1192,4 +1162,9 @@ class HelperSearch |
|
@@ -1192,4 +1162,9 @@ class HelperSearch |
1192
|
}
|
1162
|
}
|
1193
|
return $result;
|
1163
|
return $result;
|
1194
|
}
|
1164
|
}
|
|
|
1165
|
+ //分页
|
|
|
1166
|
+ public static function pager($total,$view_num){
|
|
|
1167
|
+ $Paging = new Paging('Yoho');
|
|
|
1168
|
+ return $Paging->setTotal($total)->setSize($view_num)->view(0);
|
|
|
1169
|
+ }
|
1195
|
} |
1170
|
} |