Authored by 周少峰

new sale tags

... ... @@ -21,7 +21,7 @@ class ListProcess
$result = array();
if (isset($data['product_list'])) {
$result['new'] = self::getProductData($data['product_list'], $showTag, $tagNew, $tagSale);
$result['new'] = self::getProductData($data['product_list'], false, $showTag, $tagNew, $tagSale);
}
if ($returnFilter && isset($data['filter'])) {
$result['filter'] = self::getFilterData($data['filter']);
... ... @@ -36,13 +36,13 @@ class ListProcess
* @param $data
* @return array 处理之后的商品数据
*/
public static function getProductData($data, $isApp = false)
public static function getProductData($data, $isApp = false, $showTag = true, $tagNew = true, $tagSale = true)
{
// 处理商品
$products = array();
foreach ($data as $value) {
$products[] = Helpers::formatProduct($value, true, true, true, 235, 314, true);
$products[] = Helpers::formatProduct($value, $showTag, $tagNew, $tagSale, 235, 314, true);
}
return $products;
... ...
... ... @@ -13,7 +13,10 @@ class ShopProcess
private static $shopData = array();
private static $shopId = 0;
private static $appVersion = 0;
//店铺品牌
private static $brandId;
//单品店
private static $single = false;
/**
* 组织店铺页面数据
... ... @@ -47,15 +50,23 @@ class ShopProcess
self::$shopData['storeName'] = $data['data']['is_show_shop_name'] == 'Y' ? $data['data']['shop_name'] : '';
//用户是否收藏店铺
self::$shopData['collect'] = $data['data']['is_favorite'] == 'Y' ? true : false;
//店铺id
self::$shopData['shopId'] = self::$shopId;
//全部商品链接
$allGoodsParam['title'] = '全部商品';
//单品店
if (self::$single) {
$allGoodsParam['brand'] = self::$brandId;
} else {
//店铺id
self::$shopData['shopId'] = self::$shopId;
$allGoodsParam['shop_id'] = self::$shopId;
}
if (empty(self::$appVersion)) {
//全部商品链接
self::$shopData['allGoods'] = Helpers::url('', array('shop_id' => self::$shopId, 'title' => '全部商品'), 'search');
self::$shopData['allGoods'] = Helpers::url('', $allGoodsParam, 'search');
//店铺简介页地址
self::$shopData['shopIntroHref'] = Helpers::url('/product/index/intro', array('shop_id' => self::$shopId));
} else {
self::$shopData['allGoods'] = Helpers::url('', array('shop_id' => self::$shopId, 'title' => '全部商品'), 'search').'&openby:yohobuy={"action":"go.list","params":{"title":"全部商品", "actiontype":"0","shop_id":"'.self::$shopId.'","page":"1"}}';
self::$shopData['allGoods'] = Helpers::url('', $allGoodsParam, 'search').'&openby:yohobuy={"action":"go.list","params":{"title":"全部商品", "actiontype":"0","shop_id":"'.self::$shopId.'","page":"1"}}';
self::$shopData['shopIntroHref'] = Helpers::url('/product/index/intro', array('shop_id' => self::$shopId, 'app_version' => self::$appVersion));
}
//搜索链接
... ... @@ -125,7 +136,8 @@ class ShopProcess
$brandNumber = count($data);
//少于2个不展示 单品店:单品店根据品牌id查询
if ($brandNumber < 2) {
self::$shopData['brand'] = $data[0]['id'];
self::$brandId = self::$shopData['brand'] = $data[0]['id'];
self::$single = true;
self::$shopData['shopId']= '';
return;
}
... ...
... ... @@ -295,10 +295,10 @@ class SearchController extends AbstractAction
$showTag = $this->get('showTag', 0);
$showTag = $showTag === 0 ? true : false;
//显示标签new
$tagNew = $this->get('newTag', 0);
$tagNew = $this->get('tagNew', 0);
$tagNew = $tagNew === 0 ? true : false;
//显示标签sale
$tagSale = $this->get('saleTag', 0);
$tagSale = $this->get('tagSale', 0);
$tagSale = $tagSale === 0 ? true : false;
// 过滤掉值为空的条件
$condition = array_filter($condition);
... ...
... ... @@ -414,10 +414,11 @@ class ListModel
public static function shopData($shopId, $uid, $appVersion = '')
{
$data = array();
//店铺信息
$data['shopInfo'] = ListData::getShopInfo($shopId, $uid);
//店铺装修资源数据
$data['decorator'] = ListData::getShopDecorator($shopId);
//店铺信息
$data['shopInfo'] = ListData::getShopInfo($shopId, $uid);
//店铺分类
$channel = Helpers::getChannelByCookie();
$data['shopCategory'] = ListData::getShopCategory($shopId, $channel);
... ...