Newsale.php
2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\NewsaleData;
use Plugin\DataProcess\NewSaleProcess;
/**
* 新品到着
*/
class NewsaleController extends AbstractAction
{
/**
* 新品到着
*
* @param int channel 1:男生,2:女生,3:潮童,4:创意生活
*/
public function indexAction()
{
$this->setTitle('新品到着');
$this->setNavHeader('新品到着');
$channel = $this->get('channel', 1);
if (!is_numeric($channel)) {
$this->error();
}
$data = array();
$data['newArrival'] = true;
$data['headerBanner'] = \Product\NewsaleModel::getNewFocus();
$goodsList = \Product\NewsaleModel::getNewProducts($channel, 20);
if (!empty($goodsList)) {
$data += $goodsList;
}
$this->_view->display('new', $data);
}
/**
* 折扣专区
*
* @param int channel 1:男生,2:女生,3:潮童,4:创意生活
*/
public function discountAction()
{
$this->setTitle('折扣专区');
$this->setNavHeader('Sale');
$channel = $this->get('channel', 1);
if (!is_numeric($channel)) {
$this->error();
}
$data = array();
$data['discount'] = true;
$data['headerBanner'] = \Product\NewsaleModel::getNewFocus();
$goodsList = \Product\NewsaleModel::getSaleProducts($channel, 20);
if (!empty($goodsList)) {
$data += $goodsList;
}
$this->_view->display('sale', $data);
}
/**
* Ajax方式筛选新品到着、折扣专区商品
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectNewSaleAction()
{
if ($this->isAjax()) {
$gender = $this->get('gender', '1,3');
$brand = $this->get('brand', null);
$sort = $this->get('sort', null);
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('p_d', null);
$channel = $this->get('channel', '1');
$dayLimit = $this->get('dayLimit', '1');
$limit = $this->get('limit', 20);
$page = $this->get('page', 1);
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color,
$size, $price, $p_d, $channel, $dayLimit, $limit, $page
);
$result = NewSaleProcess::selectData($data);
$this->_view->display('product', $result);
} else {
echo ' ';
}
}
}