Authored by yangyang

获取品牌folder

... ... @@ -19,6 +19,8 @@ class BrandData
const URI_BRAND_TOPPOS = 'operations/api/v5/resource/get';
const URL_BRAND_LOGO = '/shops/service/v1/brand';
const URL_BRAND_FOLDER = '/cmsproduct/service/v1/brands';
const URL_BRAND_NODECONTENT = '/operations/service/v6/htmlcontent';
/**
* 获取品牌简介
... ... @@ -79,4 +81,26 @@ class BrandData
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain ));
}
/**
* 通过品牌id获取品牌Folder
*
* @param int $brand_id 品牌id
* @param int $status 状态
* @return array
*/
public static function getFolderByBrand($brand_id,$status = 1)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_FOLDER, 'getFolderByBrand', array($brand_id,$status ));
}
/**
* 根据节点和运行模式选择静态内容
* @param $node 20141219-100447
* @param string $mode
* @return mixed
*/
public static function getByNodeContent($node, $mode='release')
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_NODECONTENT, 'getByNodeContent', array($node, $mode));
}
}
... ...
... ... @@ -3,7 +3,6 @@ namespace Product;
use Plugin\Helpers;
use LibModels\Web\Product\BrandData;
use Product\SearchModel;
/**
* Description of Brands
... ... @@ -13,9 +12,10 @@ use Product\SearchModel;
class BrandsModel
{
const URL_BRAND_INDEX = '/product/brands/index';
const URL_BRAND_INDEX = '/product/index/brand';
public static $shopName;
public static $home;
/**
* 获取品牌首页banner条
* @string $domain 品牌域名
... ... @@ -27,7 +27,7 @@ class BrandsModel
public static function getBannerByDomain($domain, $bannerId, $uid = '')
{
// 构造品牌主页url
$home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX;
self::$home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX;
// 根据品牌Id获取品牌banner图
$bannerImg = BrandData::getBrandBanner($bannerId);
if (isset($bannerImg['data'])) {
... ... @@ -66,7 +66,7 @@ class BrandsModel
'banner' => $bannerImg
),
'shopEntry' => array(
'home' => $home,
'home' => self::$home,
'logo' => $logo,
'shopName' => self::$shopName,
'sort' => array(
... ... @@ -99,6 +99,15 @@ class BrandsModel
$classes['brand'] = $condition['brand'];
// 调用商品搜索接口
$data = \Product\SearchModel::getSearchData($condition, $options,$classes);
$advNav = BrandData::getFolderByBrand($condition['brand'],1);
$result = array();
if (isset($advNav['data']) && $advNav['code'] === 200) {
foreach ($advNav['data'] as $key => $value) {
$result['list'][$key]['href'] = self::$home . '?folder=' . $value['id'];
$result['list'][$key]['src'] = $value['brand_sort_ico'];
}
}
$data['list']['advNav'] = $result;
$shopName = self::$shopName;
if(isset($data['list'])){
$arr = array_chunk($data['list']['pathNav'],1);
... ... @@ -107,6 +116,7 @@ class BrandsModel
);
}
$nav = array_merge_recursive($arr[0],$arr[1]);
$data['list']['pathNav'] = $nav;
//删除品牌列表
unset($data['list']['filters']['brand']);
... ...
... ... @@ -102,7 +102,6 @@ class IndexController extends WebAction
$this->setWebNavHeader($cate[$gender-1]);
//合并banner与搜索数据
$data = array_merge_recursive($data,$brandBanner);
//删除搜索参数中的品牌选项
//渲染模板
$this->_view->display('list',$data);
}
... ...