Authored by 周少峰

列表sale页面搜索条件调整

... ... @@ -125,7 +125,7 @@ class HelperSearch
),
'goods' => $result['product_list'],
'allSort' => array(
'updateNum' => $result['filter']['group_sort']['all']['num'],
//'updateNum' => $result['filter']['group_sort']['all']['num'],
'list' => $result['filter']['group_sort']['list']
),
'advNav' => array(),
... ... @@ -144,9 +144,20 @@ class HelperSearch
public static function getProductList($product,$imgSize){
$result = array();
foreach($product as $key => $val){
//NEW
$isNew = $val['is_new'] == 'Y' ? true : false;
$isFew = $val['is_soon_sold_out'] == 'Y' ? true : false;
//限量商品
$isLimit = isset($val['is_limited']) && $val['is_limited'] === 'Y';
//即将售罄
$isFew = $val['is_soon_sold_out'] === 'Y' ? true : false;
$is_promotion = $val['is_promotion'];
//SALE
//新品节
//再到着
//年终大促
// 年中大促
foreach($val['goods_list'] as $k => $v){
$goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']);
}
... ... @@ -156,13 +167,16 @@ class HelperSearch
$result[] = array(
'tags' => array(
'isNew' => $isNew,
'isLimit' => $isLimit,
'isYearEndPromotion' => $is_promotion
),
'url' => $goods_list[0]['url'],
'thumb' => $val['default_images'],
'name' => $val['product_name'],
'salePrice' => $val['sales_price'],
'isFew' => $isFew
'marketPrice' => $val['market_price'],
'isFew' => $isFew,
'skn' => $val['product_skn']
);
}
return $result;
... ... @@ -256,12 +270,6 @@ class HelperSearch
* @param array $params
* @return array
*/
/**
* 组织搜索列表页面的左侧分类
* @param array $sort
* @param array $params
* @return array
*/
public static function groupSort($sort, $option = array()) {
$params = self::$params;
$gender = isset($params['gender']) ? $params['gender'] : '';
... ... @@ -295,8 +303,8 @@ class HelperSearch
'sort_id' => 0,
'name' => '全部品类',
'href' => self::buildurl($query) ,
'num' => 0,
'selected' => ''
// 'num' => 0,
'active' => ''
) ,
'list' => array()
);
... ... @@ -311,12 +319,12 @@ class HelperSearch
))
);
}
$result['all']['num']+= $val['count'];
//$result['all']['num']+= $val['count'];
$msort = array(
'sort_id' => $val['sort_id'],
'name' => $val['sort_name'],
'num' => $val['count'],
'selected' => isset($params['msort']) && $params['msort'] == $val['sort_id'] ? true : false,
// 'num' => $val['count'],
'active' => isset($params['msort']) && $params['msort'] == $val['sort_id'] ? true : false,
'href' => self::buildurl(array_merge($query, array(
'msort' => $val['sort_id']
))) ,
... ... @@ -328,8 +336,8 @@ class HelperSearch
$sub[] = array(
'sort_id' => $val['sort_id'],
'name' => '全部' . $val['sort_name'],
'num' => $val['count'],
'selected' => !isset($params['misort']) && isset($params['msort']) && $params['msort'] == $val['sort_id'] ? true : false,
// 'num' => $val['count'],
'childActive' => !isset($params['misort']) && isset($params['msort']) && $params['msort'] == $val['sort_id'] ? true : false,
'href' => self::buildurl(array_merge($query, array(
'msort' => $val['sort_id']
))) ,
... ... @@ -346,8 +354,8 @@ class HelperSearch
$sub[] = array(
'sort_id' => $mval['sort_id'],
'name' => $mval['sort_name'],
'num' => $mval['count'],
'selected' => isset($params['misort']) && $params['misort'] == $mval['sort_id'] ? true : false,
// 'num' => $mval['count'],
'childActive' => isset($params['misort']) && $params['misort'] == $mval['sort_id'] ? true : false,
'href' => self::buildurl(array_merge($query, array(
'msort' => $val['sort_id'],
'misort' => $mval['sort_id']
... ... @@ -448,7 +456,7 @@ class HelperSearch
'name' => $v['brand_name'],
'alif' => $v['brand_alif'],
'href' => $url,
'selected' => in_array($v['id'], $brand_ids) ? true : false
'active' => in_array($v['id'], $brand_ids) ? true : false
);
if (count($result['default']) < 10) {
... ... @@ -1058,6 +1066,8 @@ class HelperSearch
* @return array
*/
public static function getDiscount(array $list = array()) {
$params = self::$params;
if (empty($list)) {
return array();
}
... ... @@ -1077,11 +1087,11 @@ class HelperSearch
$total+= $v['count'];
$query['p_d'] = $k;
$list[$k]['href'] = self::buildurl($query);
$list[$k]['num'] = $total;
$list[$k]['selected'] = isset($params['p_d']) && $params['p_d'] == $k ? true : false;
//$list[$k]['num'] = $total;
$list[$k]['active'] = isset($params['p_d']) && $params['p_d'] == $k ? true : false;
}
$result = array(
'updateNum' => $total,
//'updateNum' => $total,
'list' => $list
);
return $result;
... ... @@ -1115,12 +1125,12 @@ class HelperSearch
$query['shelve_time'] = '';
$query['shelve_time'] = $star_time.','.$end_time;
@$data[$i]['href'] = self::buildurl($query);
$data[$i]['num'] = $v;
//$data[$i]['num'] = $v;
$data[$i]['name'] = $k;
$i++;
}
$result = array(
'updateNum' => $total,
//'updateNum' => $total,
'list' => $data
);
return $result;
... ... @@ -1150,4 +1160,23 @@ class HelperSearch
}
return self::buildurl($param);
}
/**
* 组织产品
* @param $product
* @param $options
* @return array
*/
public static function getProductPic($product, $options)
{
$result = array();
if (isset($product[0]['goods_list']) && !empty($product[0]['goods_list'])){
foreach ($product[0]['goods_list'] as $key => $val){
$result[$key]['coverImg'] = Images::getImageUrl($val['images_url'], $options['imgSize'][0], $options['imgSize'][1]);
$result[$key]['url'] = Helpers::getUrlBySkc($product[0]['product_id'], $val['goods_id'], $product[0]['cn_alphabet']);
$result[$key]['src'] = Images::getImageUrl($val['images_url'], $options['imgSize'][0], $options['imgSize'][1]);
}
}
return $result;
}
}
... ...
{{> layout/header}}
<div class="product-search-page product-page yoho-page center-content">
{{# search}}
{{> layout/path-nav}}
{{> product/standard-content}}
{{> product/latest-walk}}
{{/ search}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -95,7 +95,7 @@ exports.init = function(num) {
});
$.ajax({
type: 'POST',
url: '/product/index/getProductPic',
url: '/product/list/getProductPic',
dataType: 'json',
data: {
skn: event.target.attr('data-skn')
... ...
... ... @@ -58,4 +58,27 @@ class SearchModel
}
return $data;
}
/**
* 根据product_sn查询产品图片信息
* @param $product_sn
* @param $options
* @author sefon 2015-12-28 18:09:28
* @return array
*/
public static function getProductPic($product_sn, $options)
{
$data = array();
$condition['query'] = $product_sn;
$condition['query'] = $product_sn;
//返回搜索条件
$condition['needFilter'] = 0;
//获取产品数据
$data = SearchData::searchElasticByCondition($condition);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list']) && !empty($data['data']['product_list'])) {
//组织数据结构
$data = HelperSearch::getProductPic($data['data']['product_list'], $options);
}
echo json_encode($data);
}
}
\ No newline at end of file
... ...
<?php
use Action\WebAction;
use Product\SearchModel;
class ListController extends WebAction
{
public function indexAction()
... ... @@ -7,6 +8,9 @@ class ListController extends WebAction
}
public function newAction(){
}
/**
* list列表sale
... ... @@ -76,9 +80,40 @@ class ListController extends WebAction
);
$params = $condition + $_GET;
$params = array_filter($params);
$data = Product\SearchModel::getSearchData($params,$options);
$data = SearchModel::getSearchData($params,$options);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
$this->_view->display('list', $data);
}
/**
* 根据product_skn获取产品图片信息
* @author sefon 2015-12-28 18:35:24
* @return json
*/
public function getProductPicAction()
{
$product_skn = $this->post('skn');
if (!$product_skn) {
return ;
}
//大图
$imgSize = array();
//小图
$minImgSize = array();
$rowNum = $this->post('rowNum');
if ($rowNum == 5) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 4;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
);
SearchModel::getProductPic($product_skn, $options);
}
}
\ No newline at end of file
... ...