Authored by hf

modify search list msort to sort

framework @ 75bbc3b0
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
... ...
... ... @@ -70,10 +70,15 @@ class SearchController extends AbstractAction
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'price' => FILTER_VALIDATE_INT,
'discount' => FILTER_VALIDATE_INT,
'discount' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
$query = isset($condition['query']) ? strtolower(trim($condition['query'])) : null;
if (isset($condition['discount'])) {
$condition['p_d'] = rawurldecode($condition['discount']);
unset($condition['discount']);
}
// 标识用户是否有输入搜索内容
$haveQuery = $query !== null;
... ... @@ -116,10 +121,10 @@ class SearchController extends AbstractAction
// 跳转到品牌商品列表页
if ($domain !== null) {
$url = Helpers::url('', array(
'from' => 'search',
'query' => $query,
'gender' => $condition['gender']
), $domain);
'from' => 'search',
'query' => $query,
'gender' => $condition['gender']
), $domain);
$this->go($url);
}
}
... ... @@ -206,7 +211,7 @@ class SearchController extends AbstractAction
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_DEFAULT,
'brand' => FILTER_VALIDATE_INT,
'sort' => FILTER_VALIDATE_INT,
'sort' => FILTER_DEFAULT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
... ... @@ -216,6 +221,17 @@ class SearchController extends AbstractAction
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
if (isset($condition['sort'])) {
$condition['sort'] = rawurldecode($condition['sort']);
}
if (isset($condition['discount'])) {
$condition['p_d'] = rawurldecode($condition['discount']);
unset($condition['discount']);
}
if (isset($condition['gender'])) {
$condition['gender'] = rawurldecode($condition['gender']);
}
// 转换排序方式
$page = $this->get('page', 1);
$order = $this->get('order', 0);
... ... @@ -240,12 +256,12 @@ class SearchController extends AbstractAction
$condition['page'] = $page;
// 搜索品类
if (!isset($condition['brand'])) {
$data += Product\ListModel::getClassData($condition);
}
$data += Product\ListModel::getClassData($condition);
}
// 搜索品牌
else {
$title = '';
$data += Product\ListModel::getBrandData($condition, $title);
$data += Product\ListModel::getBrandData($condition, $title);
}
if (isset($data['filter'])) {
unset($data['filter']);
... ...