Showing
1 changed file
with
19 additions
and
20 deletions
@@ -12,7 +12,7 @@ class NewsaleController extends AbstractAction | @@ -12,7 +12,7 @@ class NewsaleController extends AbstractAction | ||
12 | 12 | ||
13 | /** | 13 | /** |
14 | * 新品到着 | 14 | * 新品到着 |
15 | - * | 15 | + * |
16 | * @param int channel 1:男生,2:女生,3:潮童,4:创意生活 | 16 | * @param int channel 1:男生,2:女生,3:潮童,4:创意生活 |
17 | */ | 17 | */ |
18 | public function indexAction() | 18 | public function indexAction() |
@@ -20,7 +20,7 @@ class NewsaleController extends AbstractAction | @@ -20,7 +20,7 @@ class NewsaleController extends AbstractAction | ||
20 | $this->setTitle('新品到着'); | 20 | $this->setTitle('新品到着'); |
21 | $this->setNavHeader('新品到着'); | 21 | $this->setNavHeader('新品到着'); |
22 | 22 | ||
23 | - $channel = Helpers::getChannelByCookie(); | 23 | + $channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie(); |
24 | // 设置一些筛选的默认参数 | 24 | // 设置一些筛选的默认参数 |
25 | $data = array( | 25 | $data = array( |
26 | 'newArrivalPage' => true, | 26 | 'newArrivalPage' => true, |
@@ -29,21 +29,20 @@ class NewsaleController extends AbstractAction | @@ -29,21 +29,20 @@ class NewsaleController extends AbstractAction | ||
29 | 'headerBanner' => \Product\NewsaleModel::getNewFocus($channel), | 29 | 'headerBanner' => \Product\NewsaleModel::getNewFocus($channel), |
30 | 'brand' => '0', | 30 | 'brand' => '0', |
31 | 'sort' => '0', | 31 | 'sort' => '0', |
32 | - 'gender' => $this->get('gender') || Helpers::getGenderByCookie(), | ||
33 | - 'channel' => $this->get('channel'), | 32 | + 'gender' => $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(), |
33 | + 'channel' => $channel, | ||
34 | 'price' => '0', | 34 | 'price' => '0', |
35 | 'size' => '0', | 35 | 'size' => '0', |
36 | 'dayLimit' => 1, | 36 | 'dayLimit' => 1, |
37 | 'discount' => '', | 37 | 'discount' => '', |
38 | 'cartUrl' => Helpers::url('/cart/index/index', null), | 38 | 'cartUrl' => Helpers::url('/cart/index/index', null), |
39 | ); | 39 | ); |
40 | - | ||
41 | $this->_view->display('new', $data); | 40 | $this->_view->display('new', $data); |
42 | } | 41 | } |
43 | 42 | ||
44 | /** | 43 | /** |
45 | * 折扣专区 | 44 | * 折扣专区 |
46 | - * | 45 | + * |
47 | * @param int channel 1:男生,2:女生,3:潮童,4:创意生活 | 46 | * @param int channel 1:男生,2:女生,3:潮童,4:创意生活 |
48 | */ | 47 | */ |
49 | public function discountAction() | 48 | public function discountAction() |
@@ -51,8 +50,8 @@ class NewsaleController extends AbstractAction | @@ -51,8 +50,8 @@ class NewsaleController extends AbstractAction | ||
51 | $this->setTitle('折扣专区'); | 50 | $this->setTitle('折扣专区'); |
52 | $this->setNavHeader('Sale'); | 51 | $this->setNavHeader('Sale'); |
53 | 52 | ||
54 | - $channel = Helpers::getChannelByCookie(); | ||
55 | - $gender = $this->get('gender', '1,2,3'); | 53 | + $channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie(); |
54 | + $gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(); | ||
56 | // 设置一些默认参数 | 55 | // 设置一些默认参数 |
57 | $data = array( | 56 | $data = array( |
58 | 'discountPage' => true, | 57 | 'discountPage' => true, |
@@ -62,7 +61,7 @@ class NewsaleController extends AbstractAction | @@ -62,7 +61,7 @@ class NewsaleController extends AbstractAction | ||
62 | 'brand' => '0', | 61 | 'brand' => '0', |
63 | 'sort' => '0', | 62 | 'sort' => '0', |
64 | 'gender' => $gender, | 63 | 'gender' => $gender, |
65 | - 'channel' => $this->get('channel'), | 64 | + 'channel' => $channel, |
66 | 'price' => '0', | 65 | 'price' => '0', |
67 | 'size' => '0', | 66 | 'size' => '0', |
68 | 'discount' => '0.1,0.9', | 67 | 'discount' => '0.1,0.9', |
@@ -109,11 +108,11 @@ class NewsaleController extends AbstractAction | @@ -109,11 +108,11 @@ class NewsaleController extends AbstractAction | ||
109 | $tab_id = $this->get('tab_id', null); | 108 | $tab_id = $this->get('tab_id', null); |
110 | $limit = $this->get('limit', 50); | 109 | $limit = $this->get('limit', 50); |
111 | $page = $this->get('page', 1); | 110 | $page = $this->get('page', 1); |
112 | - $notab = (boolean) $this->get('notab', false); | 111 | + $notab = (boolean)$this->get('notab', false); |
113 | 112 | ||
114 | // 获取性别 | 113 | // 获取性别 |
115 | - $gender = $this->get('gender') || Helpers::getGenderByCookie(); | ||
116 | - $channel = $this->get('channel') || Helpers::getChannelByCookie(); | 114 | + $gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(); |
115 | + $channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie(); | ||
117 | $result = \Product\NewsaleModel::selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page); | 116 | $result = \Product\NewsaleModel::selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page); |
118 | } | 117 | } |
119 | if (empty($result)) { | 118 | if (empty($result)) { |
@@ -125,7 +124,7 @@ class NewsaleController extends AbstractAction | @@ -125,7 +124,7 @@ class NewsaleController extends AbstractAction | ||
125 | 124 | ||
126 | /** | 125 | /** |
127 | * Ajax方式筛选新品到着、折扣专区商品 | 126 | * Ajax方式筛选新品到着、折扣专区商品 |
128 | - * | 127 | + * |
129 | * @return array 根据指定条件筛选之后的商品 | 128 | * @return array 根据指定条件筛选之后的商品 |
130 | */ | 129 | */ |
131 | public function selectNewSaleAction() | 130 | public function selectNewSaleAction() |
@@ -133,7 +132,7 @@ class NewsaleController extends AbstractAction | @@ -133,7 +132,7 @@ class NewsaleController extends AbstractAction | ||
133 | $result = array(); | 132 | $result = array(); |
134 | 133 | ||
135 | if ($this->isAjax()) { | 134 | if ($this->isAjax()) { |
136 | - $gender = $this->get('gender', null); | 135 | + $gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(); |
137 | $brand = $this->get('brand', null); | 136 | $brand = $this->get('brand', null); |
138 | $sort = $this->get('sort', null); | 137 | $sort = $this->get('sort', null); |
139 | $color = $this->get('color', null); | 138 | $color = $this->get('color', null); |
@@ -150,10 +149,10 @@ class NewsaleController extends AbstractAction | @@ -150,10 +149,10 @@ class NewsaleController extends AbstractAction | ||
150 | $order = Helpers::transOrder($orderVal, $type); | 149 | $order = Helpers::transOrder($orderVal, $type); |
151 | 150 | ||
152 | // 转换频道 | 151 | // 转换频道 |
153 | - $channel = $this->get('channel') || Helpers::getChannelByCookie(); | 152 | + $channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie(); |
154 | 153 | ||
155 | $data = NewsaleData::selectNewSaleProducts( | 154 | $data = NewsaleData::selectNewSaleProducts( |
156 | - $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, null | 155 | + $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, null |
157 | ); | 156 | ); |
158 | $result = \Product\NewsaleModel::selectData($data); | 157 | $result = \Product\NewsaleModel::selectData($data); |
159 | } | 158 | } |
@@ -166,7 +165,7 @@ class NewsaleController extends AbstractAction | @@ -166,7 +165,7 @@ class NewsaleController extends AbstractAction | ||
166 | 165 | ||
167 | /** | 166 | /** |
168 | * Ajax方式查询筛选数据 | 167 | * Ajax方式查询筛选数据 |
169 | - * | 168 | + * |
170 | * @return array 筛选数据 | 169 | * @return array 筛选数据 |
171 | */ | 170 | */ |
172 | public function filterAction() | 171 | public function filterAction() |
@@ -174,7 +173,7 @@ class NewsaleController extends AbstractAction | @@ -174,7 +173,7 @@ class NewsaleController extends AbstractAction | ||
174 | $result = array(); | 173 | $result = array(); |
175 | 174 | ||
176 | if ($this->isAjax()) { | 175 | if ($this->isAjax()) { |
177 | - $gender = $this->get('gender', null); | 176 | + $gender = $this->get('gender') ? $this->get('gender') : Helpers::getGenderByCookie(); |
178 | $brand = $this->get('brand', null); | 177 | $brand = $this->get('brand', null); |
179 | $shop = $this->get('shop_id', null); | 178 | $shop = $this->get('shop_id', null); |
180 | $sort = $this->get('sort', null); | 179 | $sort = $this->get('sort', null); |
@@ -191,9 +190,9 @@ class NewsaleController extends AbstractAction | @@ -191,9 +190,9 @@ class NewsaleController extends AbstractAction | ||
191 | $type = $this->get('type', ''); | 190 | $type = $this->get('type', ''); |
192 | $order = Helpers::transOrder($orderVal, $type); | 191 | $order = Helpers::transOrder($orderVal, $type); |
193 | 192 | ||
194 | - $channel = $this->get('channel') || Helpers::getChannelByCookie(); | 193 | + $channel = $this->get('channel') ? $this->get('channel') : Helpers::getChannelByCookie(); |
195 | $data = NewsaleData::selectNewSaleProducts( | 194 | $data = NewsaleData::selectNewSaleProducts( |
196 | - $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, $shop | 195 | + $gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order, $shop |
197 | ); | 196 | ); |
198 | $result = \Product\NewsaleModel::filterData($data, $gender); | 197 | $result = \Product\NewsaleModel::filterData($data, $gender); |
199 | } | 198 | } |
-
Please register or login to post a comment