Search.php
3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
use Action\WebAction;
use Product\SearchModel;
class SearchController extends WebAction
{
public function indexAction()
{
//当前控制器
$options['controller'] = 'Search';
$options['action'] = 'index';
//浏览记录数
$options['reviewNum'] = 7;
$searchData = SearchModel::searchData(array(),$options);
$data = array(
//初始化js
'searchListPage' => true,
'search' => $searchData
);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
$this->_view->display('search', $data);
}
/**
* 搜索提示
*/
public function suggestAction()
{
$callback = $this->get('callback');
$query = rawurldecode($this->get('query'));
$size = rawurldecode($this->get('size',10));
if (empty($query)) {
$this->helpJsonCallbackResult($callback, 412, '搜索词为空');
}
if ($size > 50) {
$size = 10;
}
if ($query) {
$param['query'] = $query;
$param['size'] = $size;
$suggest = SearchModel::getSuggest($param);
}
$this->helpJsonCallbackResult($callback, 200, 'suggest', $suggest);
}
/**
* 根据分类id,获取分类尺码
*/
public function sortSizeAction()
{
if (!$this->isAjax()) {
$condition['msort'] = $this->get('msort');
$size = SearchModel::getSortSize($condition);
$this->echoJson($size);
}
}
/**
* 搜索错误页
*/
public function errorAction()
{
$keyword = $this->get('query');
$data = array(
//初始化js
'searchListPage' => true,
'search' => array(
'keyWord' => $keyword,
'searchActionUrl' => 'http:://search.yohobuy.com',
'latestWalk' => 7,
'pathNav' => Array(
'0'=>array(
'href' => '/',
'name' => '首页'
),
'1'=>array(
'name' => '搜索“<span id="nav_keyword">'.$keyword.'</span>”共<span id="nav_keyword_count">0</span>个结果'
)
)
)
);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
$this->_view->display('search', $data);
}
}