关于ecshop函数获取当前分类列表出所有品牌
2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家
在ecshop当中先增加函数
/** * 获得某个分类下的品牌 列表 * * @access public * @param int $cat * @return array */ function get_cat_brands($cat = 0, $app = 'category') { $children = ($cat > 0) ? ' AND ' . get_children($cat) : ''; $sql = "SELECT b.brand_id, b.brand_name, b.brand_logo, COUNT(g.goods_id) AS goods_num, IF(b.brand_logo > '', '1', '0') AS tag ". "FROM " . $GLOBALS['ecs']->table('brand') . "AS b, ". $GLOBALS['ecs']->table('goods') . " AS g ". "WHERE g.brand_id = b.brand_id $children " . "GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY tag DESC, b.sort_order ASC"; $row = $GLOBALS['db']->getAll($sql); foreach ($row AS $key => $val) { $row[$key]['url'] = build_uri($app, array('cid' => $cat, 'bid' => $val['brand_id']), $val['brand_name']); } return $row; }
2. 然后在相应模板当中增加标签:
<!--{foreach from=get_cat_brands($this->_var['cat']['id']) item=brandCat}--> <li><a href="{$brandCat.url}"><img src="data/brandlogo/{$brandCat.brand_logo}" title="{$brandCat.brand_name}" width="106" height="36"><span>{$brandCat.brand_name}</span></a></li> <!--{/foreach}-->
最近更新
常用插件
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
- ecshop二次开发商品购买增
图片1香...
ecshop热门问答
ecshop热门资料
ecshop返利
ecshop边框
ecshop显示不同
ecshop显示数量
ecshop老杨ecshp开发
ecshop计划任务
ecshop原始人
ecshop遇见
ecshop防火墙
ecshopH1标签添加
ecshopVista
ecshopgoogle地图
ecshop738
ecshop绿色模板
ecshop女鞋
ecshop素材下载
ecmall分析
ecshop全称
ecshop邮件系统
phphproce
ecshop显示价格
ecshopdenied
ecshop登录的位置在哪里
ecshop主机租用
ecshop假死
ecshop不同
ecshopfsocketopen
ecshop属性筛选
ecshopNEWS
ecshopUnknow