Authored by 周少峰

bug修改

... ... @@ -76,6 +76,9 @@ class HelperSearch
self::$options = $options;
unset(self::$params['page']);
self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array();
//当前页
$result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
self::$page = $result['page'];
//产品列表
$result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options) : array();
//总页数
... ... @@ -86,8 +89,6 @@ class HelperSearch
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();
//排序方式、显示数量等其他选项
... ... @@ -182,6 +183,10 @@ class HelperSearch
$isNew = false;
$isSale = false;
}
//SALE、NEW标签不共存
if ($isNew) {
$isSale = false;
}
$gender = 0;
if (isset(self::$options['gender'])) {
$genderArr = explode(',', self::$options['gender']);
... ... @@ -1131,6 +1136,19 @@ class HelperSearch
}
return $next;
}
/**
* 上一页
*/
public static function preUrl() {
$preUrl = '';
$param = self::$params;
$page = self::$page;
if ($page > 1) {
$param['page'] = $page - 1;
$preUrl = self::buildUrl($param);
}
return $preUrl;
}
/**
* 组织产品的图片
... ... @@ -1332,6 +1350,7 @@ class HelperSearch
$result['pageCounts'] = self::viewNum();
$result['curPage'] = self::$page;
$result['pageCount'] = self::$pageTotal;
$result['preHref'] = self::preUrl();
$result['nextHref'] = ($next = self::next(self::$pageTotal, self::$filter)) ? $next['href'] : '';
return $result;
}
... ... @@ -1355,7 +1374,7 @@ class HelperSearch
$type = isset(self::$params['msort']) && self::$params['msort'] ? self::$params['msort'] : '';
}
//新品到着
elseif ($controller == 'List' && $action == 'new') {
elseif ($controller == 'list' && $action == 'new') {
if (isset(self::$params['shelve_time'])) {
$date = explode(',', self::$params['shelve_time']);
$date = date('Y-m-d', $date[0]);
... ... @@ -1364,14 +1383,14 @@ class HelperSearch
}
//list - sale
elseif ($controller == 'list' && $action == 'sale') {
$type = isset(self::$params['discount']) && self::$params['discount'] ? self::$params['discount'] : '0,0.9';
$type = isset(self::$params['p_d']) && self::$params['p_d'] ? self::$params['p_d'] : '0,0.9';
}
elseif ($controller == 'sale' && $action == 'index') {
$type = isset(self::$params['specialsale_id']) && self::$params['specialsale_id'] ? self::$params['specialsale_id'] : '';
}
// 品牌
elseif ($controller == 'list' && $action == 'sale') {
$type = isset(self::$params['brandId']) && self::$params['brandId'] ? self::$params['brandId'] : '';
elseif ($controller == 'index' && $action == 'brand') {
$type = isset(self::$options['brandId']) && self::$options['brandId'] ? self::$options['brandId'] : '';
}
// 搜索
elseif ($controller == 'search') {
... ...
... ... @@ -57,6 +57,7 @@ class SearchModel
//关键字
if (isset($condition['query']) && !empty($condition['query'])) {
$condition['query'] = rawurldecode($condition['query']);
$condition['query'] = HelperSearch::stripTags($condition['query']);
}
//品牌
if (isset($condition['brand']) && !empty($condition['brand'])) {
... ...