分析ecshop按分类把品牌列表出来
2009-11-19 17:27 来源:www.chinab4c.com 作者:ecshop专家
//##################################
//处理分类品牌
//##################################
$array = array();
$re = $db -> getAll("select * from ".$ecs->table('category')." where parent_id = 0");
foreach($re as $k => $v){
$array[$v[cat_id]][id] = $v[cat_id];
$array[$v[cat_id]][name] = $v[cat_name];
$children = get_children($v[cat_id]);
$ar = array();
$i=0;
$r = $db -> getAll("select b.brand_id,b.brand_name from ".$ecs->table('brand')." b , ".$ecs->table('goods')." g where b.brand_id = g.brand_id and $children ");
foreach($r as $key => $val){
$ar[$i][brand_id] =$val[brand_id];
$ar[$i][brand_name]=$val[brand_name];
}
$array[$v[cat_id]][brand_list] = $ar;
}
//##################################
//分类品牌结束了
//##################################
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<div class="modTitle clearfix">
<span class="left"></span><span class="right"></span>
<div class="f_l">分类品牌</div>
<div class="more"><a href="catalog.php" target="_blank">{$lang.catalog}</a></div>
</div>
<div class="modBox">
<dl id="category_tree">
<!--{foreach from=$brandlist item=cat}-->
<div class="toggleblock">
<dt class="clearfix">
<a href="category.php?id={$cat.id}" class="f_l">{$cat.name|escape:html}</a></dt>
<!--{if $cat.brand_list}-->
<dd>
<!--{foreach from=$cat.brand_list item=child}-->
<a href="category.php?id={$cat.id}&brand={$child.brand_id}" title="{$child.name|escape:html}">{$child.brand_name|escape:html}</a>
<!--{/foreach}-->
</dd>
<!--{/if}-->
</div>
<!--{/foreach}-->
</dl>
</div>
最近更新
常用插件
- ecshop二次开发售后维修卡
插件介绍: 本插件是用于专门从事电子,信息,软件等售后服务关键比...
- ecshop2.7.2购买流程简化
ecshop2.7.2购买流程简化,已经很多朋友都在研究和追问这个问题.很多做...
- ecshop二次开发报价单
本站为了规范将来ecshop二次开发,为了更好的为ecshop使用用户服务,特此...
- ecshop2.7销售返利插件
ecshop2.7销售返利插件 ,这个插件秉承了ecshop早期版本的ecshop返利插件,...
- ecshop修改商品详细页面插
插件介绍:该ecshop插件主要是通过对ecshop后台的商品管理进行了扩展,对...