Authored by 周少峰

错误页

... ... @@ -77,15 +77,19 @@ class HelperSearch
//产品列表
$result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array();
//总页数
$result['page_total'] = isset($data['product']['page_total']) ? $data['product']['page_total'] : '';
self::$pageTotal = $result['page_total'];
self::$total = $data['product']['total'];
if (isset($data['product']['page_total'])) {
$result['page_total'] = $data['product']['page_total'];
self::$pageTotal = $result['page_total'];
}
if (isset($data['product']['total'])) {
self::$total = $data['product']['total'];
}
//当前页
self::$page = $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
//筛选条件
$result['filters'] = isset($data['product']['filter']) ? self::filter() : array();
//排序方式、显示数量等其他选项
$result['opts'] = isset($data['product']['filter']) ? self::getOpts() : array();
$result['opts'] = self::getOpts();
//下一页
if (isset($data['product']['page_total'])) {
$result['hasNextPage'] = self::next($data['product']['page_total']);
... ... @@ -621,7 +625,7 @@ class HelperSearch
//设置已选中价格
if (!empty($priceId)) {
$price = explode(',' ,$priceId);
$customName = self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$price[0] . '-' . (int)$price[1];
$customName = isset($price[1]) && $price[1] == 99999 ? '¥'.$price[0].'以上' : '¥' . intval($price[0]-1) . '-' . intval($price[1]);
$name = isset($filter['price'][$priceId]) ? $filter['price'][$priceId] : $customName;
self::$selected['price'] = array(
'name' => $name,
... ...
... ... @@ -31,6 +31,7 @@ class SearchModel
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_SANITIZE_STRING,
'keyword' => FILTER_SANITIZE_STRING,
'brand' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_SANITIZE_STRING,
... ... @@ -49,6 +50,10 @@ class SearchModel
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT), false);
//keyword=>query关键字
if (isset($condition['keyword']) && !empty($condition['keyword'])) {
$condition['query'] = rawurldecode($condition['keyword']);
}
//关键字
if (isset($condition['query']) && !empty($condition['query'])) {
$condition['query'] = rawurldecode($condition['query']);
... ...
... ... @@ -53,4 +53,35 @@ class SearchController extends WebAction
$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);
}
}
\ No newline at end of file
... ...