...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
use Action\AbstractAction;
|
|
|
use LibModels\Wap\Product\SearchData;
|
|
|
use LibModels\Wap\Category\BrandData;
|
|
|
use LibModels\Wap\Category\ClassData;
|
|
|
use Plugin\DataProcess\ListProcess;
|
|
|
use Plugin\Helpers;
|
|
|
|
...
|
...
|
@@ -11,33 +12,115 @@ use Plugin\Helpers; |
|
|
*/
|
|
|
class ListController extends AbstractAction
|
|
|
{
|
|
|
/**
|
|
|
* 搜索列表页
|
|
|
*/
|
|
|
public function indexAction()
|
|
|
{
|
|
|
$query = $this->get('query', null);
|
|
|
$brand = $this->get('brand', null);
|
|
|
$gender = $this->get('gender', null);
|
|
|
$p_d = $this->get('p_d', null);
|
|
|
$misort = $this->get('misort', null);
|
|
|
$msort = $this->get('msort', null);
|
|
|
|
|
|
$data = array(
|
|
|
'pageHeader' => array(
|
|
|
'navBack' => true,
|
|
|
'navTitle' => '搜索',
|
|
|
'navHome' => '/'
|
|
|
),
|
|
|
'goodListPage' => true,
|
|
|
'goodList' => array(
|
|
|
)
|
|
|
'goodList' => array()
|
|
|
);
|
|
|
|
|
|
// 如果存在搜索字符串就显示搜索栏
|
|
|
if(!is_null($query))
|
|
|
{
|
|
|
$data['search'] = array(
|
|
|
'default' => $query
|
|
|
);
|
|
|
}
|
|
|
|
|
|
// 查询数据
|
|
|
$listData = SearchData::searchLiDatas($query, $brand, $gender, $p_d, $misort, $msort);
|
|
|
// 处理返回的数据
|
|
|
if (isset($listData['code']) && $listData['code'] === 200) {
|
|
|
$tmpData = $listData['data'];
|
|
|
|
|
|
// 如果存在品牌信息就显示品牌字段
|
|
|
if(isset($tmpData['brand']) && !empty($tmpData['brand']))
|
|
|
{
|
|
|
$brandData = $tmpData['brand'];
|
|
|
$data['brandWay'] = array(
|
|
|
'url' => '/product/list/brand?brand='.$brandData['id'],
|
|
|
'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40),
|
|
|
'name' => $brandData['brand_name']
|
|
|
);
|
|
|
}
|
|
|
|
|
|
$data['goodList'] = ListProcess::getListData($tmpData);
|
|
|
}
|
|
|
|
|
|
$this->_view->display('index', $data);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Ajax异步筛选请求
|
|
|
*/
|
|
|
public function searchAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$query = $this->get('query', null);
|
|
|
$brand = $this->get('brand', null);
|
|
|
$gender = $this->get('gender', null);
|
|
|
$p_d = $this->get('p_d', null);
|
|
|
$misort = $this->get('misort', null);
|
|
|
$msort = $this->get('msort', null);
|
|
|
|
|
|
$order = $this->get('order', null);
|
|
|
$type = $this->get('type', '');
|
|
|
switch ($type) {
|
|
|
case 'price':
|
|
|
$order = ($order == 0) ? 's_p_desc' : 's_p_asc';
|
|
|
break;
|
|
|
case 'discount':
|
|
|
$order = ($order == 0) ? 'p_d_desc' : 'p_d_asc';
|
|
|
break;
|
|
|
case 'newest':
|
|
|
default:
|
|
|
$order = ($order == 0) ? 's_t_desc' : 's_t_asc';
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = array();
|
|
|
// 查询数据
|
|
|
$listData = SearchData::searchLiDatas(null, $brand, $gender, $p_d, $misort, $msort);
|
|
|
$listData = SearchData::searchLiDatas($query, $brand, $gender, $p_d, $misort, $msort, $order);
|
|
|
// 处理返回的数据
|
|
|
if (isset($listData['code']) && $listData['code'] === 200) {
|
|
|
$tmpData = $listData['data'];
|
|
|
|
|
|
$data['goodList'] = ListProcess::getListData($tmpData);
|
|
|
unset($tmpData['filter']);// 不要筛选条件的数据
|
|
|
$data = ListProcess::getListData($tmpData);
|
|
|
}
|
|
|
|
|
|
$this->_view->display('index', $data);
|
|
|
if(empty($data))
|
|
|
{
|
|
|
echo ' ';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
$this->_view->display('list', $data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 品牌商品列表页
|
|
|
*/
|
|
|
public function brandAction()
|
|
|
{
|
|
|
$brand = $this->get('brand', null);
|
...
|
...
|
@@ -50,6 +133,7 @@ class ListController extends AbstractAction |
|
|
|
|
|
$data = array(
|
|
|
'pageHeader' => array(
|
|
|
'navBack' => true,
|
|
|
'navHome' => '/'
|
|
|
),
|
|
|
'goodListPage' => true,
|
...
|
...
|
@@ -89,4 +173,38 @@ class ListController extends AbstractAction |
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 品类商品列表页
|
|
|
*/
|
|
|
public function classAction()
|
|
|
{
|
|
|
$brand = $this->get('brand', null);
|
|
|
$gender = $this->get('gender', 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);
|
|
|
|
|
|
$data = array(
|
|
|
'pageHeader' => array(
|
|
|
'navBack' => true,
|
|
|
'navHome' => '/'
|
|
|
),
|
|
|
'goodListPage' => true,
|
|
|
'goodList' => array()
|
|
|
);
|
|
|
|
|
|
// 查询数据
|
|
|
$listData = ClassData::selectClassDetail($gender, $brand, $sort, $color, $size, $price, $p_d);
|
|
|
// 处理返回的数据
|
|
|
if (isset($listData['code']) && $listData['code'] === 200) {
|
|
|
$tmpData = $listData['data'];
|
|
|
|
|
|
$data['goodList'] = ListProcess::getListData($tmpData);
|
|
|
}
|
|
|
|
|
|
$this->_view->display('index', $data);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|