|
|
<?php
|
|
|
use Action\WebAction;
|
|
|
use LibModels\Web\Product\BrandData;
|
|
|
use Product\SearchModel;
|
|
|
|
|
|
class IndexController extends WebAction
|
|
|
{
|
|
|
|
...
|
...
|
@@ -24,77 +26,15 @@ class IndexController extends WebAction |
|
|
$this->go(SITE_MAIN);
|
|
|
}
|
|
|
|
|
|
/* 过滤请求参数 */
|
|
|
$condition = array();
|
|
|
$condition = filter_input_array(INPUT_GET, array(
|
|
|
//'query' => FILTER_SANITIZE_STRING,
|
|
|
'sort' => FILTER_VALIDATE_INT,
|
|
|
'msort' => FILTER_VALIDATE_INT,
|
|
|
'misort' => FILTER_VALIDATE_INT,
|
|
|
'color' => FILTER_VALIDATE_INT,
|
|
|
'size' => FILTER_VALIDATE_INT,
|
|
|
'style' => FILTER_DEFAULT,
|
|
|
'price' => FILTER_DEFAULT,
|
|
|
'gender' => FILTER_DEFAULT,
|
|
|
'p_d' => FILTER_DEFAULT,
|
|
|
'shelve_time' => FILTER_DEFAULT,
|
|
|
'isNew' => FILTER_DEFAULT,
|
|
|
'specialoffer' => FILTER_DEFAULT,
|
|
|
'limited' => FILTER_DEFAULT,
|
|
|
'order' => FILTER_DEFAULT,
|
|
|
'viewNum' => FILTER_VALIDATE_INT,
|
|
|
'rowNum' => FILTER_VALIDATE_INT,
|
|
|
'page' => FILTER_VALIDATE_INT,), false);
|
|
|
|
|
|
//字符转码
|
|
|
if (!empty($condition)) {
|
|
|
foreach ($condition as &$value) {
|
|
|
$value = rawurldecode($value);
|
|
|
}
|
|
|
}
|
|
|
//传品牌ID参数
|
|
|
$condition = array();
|
|
|
$condition['brand'] = $brandId;
|
|
|
|
|
|
//获取性别数据
|
|
|
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1));
|
|
|
$condition['gender'] = $gender;
|
|
|
/* 过滤请求参数 */
|
|
|
SearchModel::SearchCondition($condition);
|
|
|
|
|
|
//每页显示商品数
|
|
|
if (!isset($condition['viewNum']) || empty($condition['viewNum'])) {
|
|
|
$condition['viewNum'] =60;
|
|
|
}
|
|
|
$view_num_arr = array(60, 100, 200);
|
|
|
if (!in_array($condition['viewNum'], $view_num_arr)) {
|
|
|
$condition['viewNum'] = 60;
|
|
|
}
|
|
|
//每行显示的商品数量
|
|
|
if (!isset($condition['rowNum']) || empty($condition['rowNum'])) {
|
|
|
$condition['rowNum'] =5;
|
|
|
}
|
|
|
if ($condition['rowNum'] == 6) {
|
|
|
$imgSize = array(195, 260);
|
|
|
$minImgSize = array(50, 67);
|
|
|
} else {
|
|
|
$condition['rowNum'] = 5;
|
|
|
$imgSize = array(235, 314);
|
|
|
$minImgSize = array(60, 80);
|
|
|
}
|
|
|
//搜索词
|
|
|
//$query = $this->get('query');
|
|
|
$condition['needFilter'] = 1;
|
|
|
$options = array(
|
|
|
'imgSize' => $imgSize,
|
|
|
'minImgSize' => $minImgSize,
|
|
|
'gender' => $gender,
|
|
|
'needPd' => 'Y',
|
|
|
'rowNum' => $condition['rowNum'],
|
|
|
'viewNum' => $condition['viewNum'],
|
|
|
);
|
|
|
|
|
|
$params = $condition + $_GET;
|
|
|
$params = array_filter($params);
|
|
|
//每页记录数减1,下一页占位
|
|
|
$params['viewNum'] = $params['viewNum'] - 1;
|
|
|
|
|
|
$data = Product\BrandsModel::getBrandSearchData($params,$options,$domain,$uid,$brandId,$node);
|
|
|
$cate = array('boys','girls','kids','lifestyle');
|
|
|
$this->setWebNavHeader($cate[$gender-1]);
|
...
|
...
|
|