Authored by 郭成尧

'gender_channel'

... ... @@ -12,7 +12,7 @@ class NewsaleController extends AbstractAction
/**
* 新品到着
*
*
* @param int channel 1:男生,2:女生,3:潮童,4:创意生活
*/
public function indexAction()
... ... @@ -20,7 +20,7 @@ class NewsaleController extends AbstractAction
$this->setTitle('新品到着');
$this->setNavHeader('新品到着');
$channel = Helpers::getChannelByCookie();
$channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie();
// 设置一些筛选的默认参数
$data = array(
'newArrivalPage' => true,
... ... @@ -29,21 +29,20 @@ class NewsaleController extends AbstractAction
'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
'brand' => '0',
'sort' => '0',
'gender' => $this->get('gender') || Helpers::getGenderByCookie(),
'channel' => $this->get('channel'),
'gender' => $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(),
'channel' => $channel,
'price' => '0',
'size' => '0',
'dayLimit' => 1,
'discount' => '',
'cartUrl' => Helpers::url('/cart/index/index', null),
);
$this->_view->display('new', $data);
}
/**
* 折扣专区
*
*
* @param int channel 1:男生,2:女生,3:潮童,4:创意生活
*/
public function discountAction()
... ... @@ -51,8 +50,8 @@ class NewsaleController extends AbstractAction
$this->setTitle('折扣专区');
$this->setNavHeader('Sale');
$channel = Helpers::getChannelByCookie();
$gender = $this->get('gender', '1,2,3');
$channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie();
$gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie();
// 设置一些默认参数
$data = array(
'discountPage' => true,
... ... @@ -62,7 +61,7 @@ class NewsaleController extends AbstractAction
'brand' => '0',
'sort' => '0',
'gender' => $gender,
'channel' => $this->get('channel'),
'channel' => $channel,
'price' => '0',
'size' => '0',
'discount' => '0.1,0.9',
... ... @@ -109,11 +108,11 @@ class NewsaleController extends AbstractAction
$tab_id = $this->get('tab_id', null);
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$notab = (boolean) $this->get('notab', false);
$notab = (boolean)$this->get('notab', false);
// 获取性别
$gender = $this->get('gender') || Helpers::getGenderByCookie();
$channel = $this->get('channel') || Helpers::getChannelByCookie();
$gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie();
$channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page);
}
if (empty($result)) {
... ... @@ -125,7 +124,7 @@ class NewsaleController extends AbstractAction
/**
* Ajax方式筛选新品到着、折扣专区商品
*
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectNewSaleAction()
... ... @@ -133,7 +132,7 @@ class NewsaleController extends AbstractAction
$result = array();
if ($this->isAjax()) {
$gender = $this->get('gender', null);
$gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie();
$brand = $this->get('brand', null);
$sort = $this->get('sort', null);
$color = $this->get('color', null);
... ... @@ -150,10 +149,10 @@ class NewsaleController extends AbstractAction
$order = Helpers::transOrder($orderVal, $type);
// 转换频道
$channel = $this->get('channel') || Helpers::getChannelByCookie();
$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, null
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, null
);
$result = \Product\NewsaleModel::selectData($data);
}
... ... @@ -166,7 +165,7 @@ class NewsaleController extends AbstractAction
/**
* Ajax方式查询筛选数据
*
*
* @return array 筛选数据
*/
public function filterAction()
... ... @@ -174,7 +173,7 @@ class NewsaleController extends AbstractAction
$result = array();
if ($this->isAjax()) {
$gender = $this->get('gender', null);
$gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie();
$brand = $this->get('brand', null);
$shop = $this->get('shop_id', null);
$sort = $this->get('sort', null);
... ... @@ -191,9 +190,9 @@ class NewsaleController extends AbstractAction
$type = $this->get('type', '');
$order = Helpers::transOrder($orderVal, $type);
$channel = $this->get('channel') || Helpers::getChannelByCookie();
$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, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, $shop
);
$result = \Product\NewsaleModel::filterData($data, $gender);
}
... ...