Authored by runner

filter age update

... ... @@ -78,10 +78,11 @@ class NewsaleData
*
* @return array 根据指定条件筛选出来的商品
*/
public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 60, $page = 1, $order = 's_t_desc', $shop)
public static function selectNewSaleProducts($gender, $age_level, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 60, $page = 1, $order = 's_t_desc', $shop)
{
$selectItems = array(
'gender' => $gender,
'age_level' => $age_level,
'brand' => $brand,
'shop_id' => $shop,
'sort' => $sort,
... ... @@ -92,13 +93,20 @@ class NewsaleData
'dayLimit' => $dayLimit
);
// 拉取筛选参数
$queriedParams = array_filter($selectItems, function($v) {
return !empty($v);
});
if (isset($selectItems['age_level']) && $selectItems['age_level'] === '0'){
$queriedParams = array_filter($selectItems, function($v) {
return !empty($v);
});
$queriedParams['age_level'] = '0';
}else {
$queriedParams = array_filter($selectItems, function($v) {
return !empty($v);
});
}
$param = Yohobuy::param();
if (!is_null($dayLimit)) {
$param['method'] = 'app.search.newProduct';
$param['method'] = 'app.search.sales';
} else {
$param['method'] = 'app.search.sales';
$param['p_d'] = '0.1,0.9';
... ...
... ... @@ -211,6 +211,11 @@ function search(opt) {
color: opt.id
};
break;
case 'ageLevel':
ext = {
age_level: opt.id
};
break;
case 'size':
ext = {
size: opt.id
... ...
... ... @@ -109,6 +109,11 @@ function search(opt) {
brand: opt.id
};
break;
case 'ageLevel':
ext = {
age_level: opt.id
};
break;
case 'sort':
ext = {
sort: opt.id
... ...
... ... @@ -128,6 +128,11 @@ function search(opt) {
color: opt.id
};
break;
case 'ageLevel':
ext = {
age_level: opt.id
};
break;
case 'size':
ext = {
size: opt.id
... ...
... ... @@ -58,6 +58,10 @@
<input class="query-param" type="hidden" data-attr="p_d" value="{{p_d}}">
{{/if}}
{{#if age_level}}
<input class="query-param" type="hidden" data-attr="age_level" value="{{age_level}}">
{{/if}}
{{#if channel}}
<input class="query-param" type="hidden" data-attr="channel" value="{{channel}}">
{{/if}}
... ...
... ... @@ -250,6 +250,7 @@ class SearchController extends AbstractAction
'channel' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'outlets' => FILTER_DEFAULT,
'age_level' => FILTER_DEFAULT,
'page' => FILTER_VALIDATE_INT,), false);
if (!empty($condition['shop_id'])) {
... ... @@ -298,6 +299,10 @@ class SearchController extends AbstractAction
if (isset($condition['gender'])) {
$condition['gender'] = rawurldecode($condition['gender']);
}
// 转义性别
if (isset($condition['age_level'])) {
$condition['age_level'] = rawurldecode($condition['age_level']);
}
if (isset($condition['query'])) {
$condition['query'] = rawurldecode($condition['query']);
}
... ... @@ -321,7 +326,12 @@ class SearchController extends AbstractAction
$tagSale = $this->get('tagSale', 0);
$tagSale = $tagSale === 0 ? true : false;
// 过滤掉值为空的条件
$condition = array_filter($condition);
if (isset($condition['age_level']) && $condition['age_level'] === '0'){ //年龄删选的成人id为0
$condition = array_filter($condition);
$condition['age_level'] = '0';
}else{
$condition = array_filter($condition);
}
// /* 模糊搜索关键词 */
// if (isset($condition['query'])) {
... ...
... ... @@ -133,6 +133,7 @@ class NewsaleController extends AbstractAction
if ($this->isAjax()) {
$gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie();
$age_level = $this->get('age_level', null);
$brand = $this->get('brand', null);
$sort = $this->get('sort', null);
$color = $this->get('color', null);
... ... @@ -166,7 +167,7 @@ class NewsaleController extends AbstractAction
}
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, null
$gender, '0', $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, null
);
$result = \Product\NewsaleModel::selectData($data);
}
... ... @@ -188,6 +189,7 @@ class NewsaleController extends AbstractAction
if ($this->isAjax()) {
$gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie();
$age_level = $this->get('$age_level', null);
$brand = $this->get('brand', null);
$shop = $this->get('shop_id', null);
$sort = $this->get('sort', null);
... ... @@ -206,7 +208,7 @@ class NewsaleController extends AbstractAction
$channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie();
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, $shop
$gender, $age_level, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, $shop
);
$result = \Product\NewsaleModel::filterData($data, $gender);
}
... ...