Authored by 郝肖肖

店铺装修 全部品类 通过brand €判断

... ... @@ -29,6 +29,9 @@ class ShopModel
if (is_callable("self::$fun")) {
$list = self::$fun(self::getResourceData($list), $parameters);
switch ($fun) {
case 'signboard':
//过滤不合法的数据
break;
case 'newProducts':
$data['newArrivel']['name'] = '新品上架 NEW';
$data['newArrivel']['list'] = $list;
... ... @@ -80,7 +83,8 @@ class ShopModel
$urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$sortCondition = array();
$sortCondition = $searchCondition['sortCondition'];
$sortCondition['brand'] = self::getShopsBrandIds($shopId);
if (isset($searchCondition['condition']['misort']) && !empty($searchCondition['condition']['misort'])) {
$sortCondition['needSmallSort'] = 1;
}
... ... @@ -135,6 +139,7 @@ class ShopModel
switch ($fun) {
case 'newProducts':
case 'hotProducts':
case 'signboard':
break;
case 'goodsTabBar':
if (isset($list['hot'])) {
... ... @@ -176,7 +181,7 @@ class ShopModel
$urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$sortCondition = array();
$sortCondition = $searchCondition['sortCondition'];
$sortCondition['brand'] = self::getShopsBrandIds($shopId);
if (isset($searchCondition['condition']['misort']) && !empty($searchCondition['condition']['misort'])) {
$sortCondition['needSmallSort'] = 1;
}
... ... @@ -715,12 +720,35 @@ class ShopModel
return $result;
}
/**
* 获取店铺下的品牌
* @param type $shopId 店铺id
* @return type []
*/
public static function getShopsBrands($shopId)
{
return ShopData::getShopsBrands($shopId);
$result = ShopData::getShopsBrands($shopId);
return empty($result['data']) ? array() : $result['data'];
}
/**
* 获取店铺下的品牌id
* @param type $shopId 店铺id
* @return array []
*/
public static function getShopsBrandIds($shopId)
{
$brands = array();
$result = self::getShopsBrands($shopId);
if (!empty($result)) {
foreach ($result as $val) {
$brands[] = $val['brand_id'];
}
}
return implode(',', $brands);
}
public static function getSearch($shopId)
{
return ShopData::getSearch($shopId);
... ...
... ... @@ -17,6 +17,11 @@ class IndexController extends WebAction
*/
public function brandAction()
{
$shopId = $this->get('shopId', 0);
if (!empty($shopId)) {
$this->shopHome($shopId);
exit(0);
}
//品牌域名,没有获取到品牌域名的跳转首页
$domain = $this->param('named');
if (empty($domain)) {
... ... @@ -31,7 +36,6 @@ class IndexController extends WebAction
$type = intval(isset($result['type']) ? $result['type'] : '');
switch ($type) {
case 1:
$shopId = $this->get('shopId', 0);
if (empty($shopId)) {
//无单品店有多品店:1--->搜索页
$this->go('http://search.yohobuy.com/?query=' . $domain);
... ... @@ -355,19 +359,11 @@ class IndexController extends WebAction
//店铺列表页
public function shopListAction()
{
//品牌域名,没有获取到品牌域名的跳转首页
$domain = $this->param('named');
if (empty($domain)) {
$this->go(SITE_MAIN);
}
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
$result = BrandsModel::getBrandByDomain($domain);
if (!$result) {
$shopId = $this->get('shopId', 0);
if (empty($shopId)) {
$this->go(SITE_MAIN);
}
$shopId = empty($result['shopId']) ? $this->get('shopId', 0) : $result['shopId'];
//获取uid
$uid = $this->getUid();
... ...