Sale.php
2.65 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
<?php
use Action\WebAction;
use LibModels\Web\Product\SaleData;
use Product\SaleModel;
/**
* sale页
*
*/
class SaleController extends WebAction
{
public function indexAction()
{
//获取专区ID
$specialsaleId = $this->get('specialsale_id');
if (empty($specialsaleId)) {
$specialsaleId = $this->param('specialsaleId');
}
//获取促销ID
$promotion = $this->get('promotion');
//专区ID和促销ID都为空时,跳转到主页
if (empty($specialsaleId) && empty($promotion)) {
$this->go(SITE_MAIN);
}
$specialInfo = SaleData::getSpecial($specialsaleId);
if(isset($specialInfo['data'])) {
$special = $specialInfo['data'];
} else {
$special = array();
}
$condition = array();
//传品牌ID参数
if(!empty($special['brand_id'])){
$condition['brand'] = $special['brand_id'];
}
//传促销id,促销id为空时传专区id
if(!empty($special['ispromotion'])){
$condition['promotion'] = $special['ispromotion'];
}else{
$condition['promotion'] = $promotion;
}
$options = array(
'controller' => 'Sale',
'action' => 'index',
'reviewNum' => 6
);
$saleData = SaleModel::getSaleSearchData($condition, $options, $specialInfo);
//统计前三个商品
$skn=array();
$arr=array();
if (isset($saleData['goods']) && !empty($saleData['goods'])) {
$arr = array_slice($saleData['goods'],0,3);
foreach ($arr as $key=>$value) {
$skn[] = $value['skn'];
}
$arr = array('skn'=>$skn);
}else{
$arr = array('skn'=>array());
}
$data = array(
//初始化js
'productListPage' => true,
'newSale' => $saleData,
'criteo' => $arr
);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
//渲染模板
$this->_view->display('new-sale', $data);
}
}