...
|
...
|
@@ -123,15 +123,31 @@ class HelperSearch |
|
|
'pageCount' => $result['page_total'],
|
|
|
'nextHref' => $result['filter']['next']
|
|
|
),
|
|
|
'hasNextPage' => array(
|
|
|
'href' => $result['filter']['next'],
|
|
|
'src' => 'http://img10.static.yhbimg.com/product/2014/01/15/11/01fa01614784f6239760f1b749663016f1.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
|
|
|
),
|
|
|
'goods' => $result['product_list'],
|
|
|
'allSort' => array(
|
|
|
'updateNum' => $result['filter']['group_sort']['all']['num'],
|
|
|
'list' => $result['filter']['group_sort']['list']
|
|
|
'leftContent' => array(
|
|
|
array(
|
|
|
'allSort' => array(
|
|
|
//'updateNum' => $result['filter']['group_sort']['all']['num'],
|
|
|
'list' => $result['filter']['group_sort']['list']
|
|
|
)
|
|
|
),
|
|
|
array(
|
|
|
'advNav' => array()
|
|
|
),
|
|
|
array(
|
|
|
'advPic' => array()
|
|
|
),
|
|
|
array(
|
|
|
'newSales' => $result['filter']['recent']
|
|
|
),
|
|
|
array('allDiscount' => $result['filter']['discount'])
|
|
|
),
|
|
|
'advNav' => array(),
|
|
|
'advPic' => array(),
|
|
|
'newSales' => $result['filter']['recent'],
|
|
|
'allDiscount' => $result['filter']['discount']
|
|
|
'totalCount' => $result['total'],
|
|
|
|
|
|
);
|
|
|
return $data;
|
|
|
}
|
...
|
...
|
@@ -144,9 +160,18 @@ 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;
|
|
|
$is_promotion = $val['is_promotion'];
|
|
|
//限量商品
|
|
|
$isLimit = isset($val['is_limited']) && $val['is_limited'] === 'Y';
|
|
|
//即将售罄
|
|
|
$isFew = $val['is_soon_sold_out'] === 'Y' ? true : false;
|
|
|
//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 +181,15 @@ class HelperSearch |
|
|
$result[] = array(
|
|
|
'tags' => array(
|
|
|
'isNew' => $isNew,
|
|
|
'isYearEndPromotion' => $is_promotion
|
|
|
'isLimit' => $isLimit
|
|
|
),
|
|
|
'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 +283,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 +316,8 @@ class HelperSearch |
|
|
'sort_id' => 0,
|
|
|
'name' => '全部品类',
|
|
|
'href' => self::buildurl($query) ,
|
|
|
'num' => 0,
|
|
|
'selected' => ''
|
|
|
// 'num' => 0,
|
|
|
'active' => ''
|
|
|
) ,
|
|
|
'list' => array()
|
|
|
);
|
...
|
...
|
@@ -311,12 +332,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 +349,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 +367,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 +469,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 +1079,8 @@ class HelperSearch |
|
|
* @return array
|
|
|
*/
|
|
|
public static function getDiscount(array $list = array()) {
|
|
|
$params = self::$params;
|
|
|
|
|
|
if (empty($list)) {
|
|
|
return array();
|
|
|
}
|
...
|
...
|
@@ -1077,11 +1100,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;
|
...
|
...
|
@@ -1094,7 +1117,7 @@ class HelperSearch |
|
|
if (empty($list)) {
|
|
|
return array();
|
|
|
}
|
|
|
$params = $_GET;
|
|
|
$params = self::$params;
|
|
|
$query = array();
|
|
|
if (isset($params['gender'])) {
|
|
|
$query['gender'] = $params['gender'];
|
...
|
...
|
@@ -1106,21 +1129,21 @@ class HelperSearch |
|
|
$query['misort'] = $params['misort'];
|
|
|
}
|
|
|
$data = array();
|
|
|
$total = 0;
|
|
|
$i = 0;
|
|
|
foreach ($list as $k => $v) {
|
|
|
$total+= $v;
|
|
|
$star_time = strtotime($k);
|
|
|
$end_time = $star_time+60*60*24;
|
|
|
$query['shelve_time'] = '';
|
|
|
$query['shelve_time'] = $star_time.','.$end_time;
|
|
|
if (isset($params['shelve_time']) && $query['shelve_time'] == $params['shelve_time']) {
|
|
|
$data[$i]['active'] = true;
|
|
|
}
|
|
|
@$data[$i]['href'] = self::buildurl($query);
|
|
|
$data[$i]['num'] = $v;
|
|
|
$data[$i]['name'] = $k;
|
|
|
$i++;
|
|
|
}
|
|
|
$result = array(
|
|
|
'updateNum' => $total,
|
|
|
//'updateNum' => $total,
|
|
|
'list' => $data
|
|
|
);
|
|
|
return $result;
|
...
|
...
|
@@ -1150,4 +1173,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;
|
|
|
}
|
|
|
} |
...
|
...
|
|