1.进入ecshop->uoload->theme->default->library->category_tree.lbi将里边的代码清空,并且将以下代码复制到进去
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div class="box">
<input type="button" id="button1" value="商品分类" style="width:60px;font-size:12px" />
<input type="button" id="button2" value="品牌分类" style="width:60px;font-size:12px"/>
<input type="button" id="button3" value="供货商" style="width:50px;font-size:12px"/>
<div class="box_1" id="ce1">
<div id="category_tree">
<!--{foreach from=$categories item=cat}-->
<dl>
<dt><a href="{$cat.url}">{$cat.name|escape:html}</a></dt>
<!--{foreach from=$cat.cat_id item=child}-->
<dd><a href="{$child.url}">{$child.name|escape:html}</a></dd>
<!--{foreach from=$child.cat_id item=childer}-->
<dd> <a href="{$childer.url}">{$childer.name|escape:html}</a></dd>
<!--{/foreach}-->
<!--{/foreach}-->
</dl>
<!--{/foreach}-->
</div>
</div>
<div class="box_1" id="ce2" style="display:none">
<div id="category_tree">
<!--{foreach from=$前边所传过来的数据(sql) item=起个名称(aa)}-->
<dl>
<dd><a href="#">{$起个名称(aa).数据库名称(brand_name)}</a></dd>
</dl>
<!--{/foreach}-->
</div>
</div>
<div class="box_1" id="ce3" style="display:none">
<div id="category_tree">
<!--{foreach from=$categories item=cat}-->
<dl>
<dd><a href="#">供货商测试</a></dd>
</dl>
<!--{/foreach}-->
</div>
</div>
<div class="blank5"></div>
<script>
var button1=document.getElementById('button1');
var button2=document.getElementById('button2');
var button3=document.getElementById('button3');
var ce1=document.getElementById('ce1');
var ce2=document.getElementById('ce2');
var ce3=document.getElementById('ce3');
button1.οnclick=function(){
ce2.style="display:none";
ce3.style="display:none";
ce1.style="display:block";
}
button2.οnclick=function(){
ce2.style="display:block";
ce3.style="display:none";
ce1.style="display:none";
}
button3.οnclick=function(){
ce2.style="display:none";
ce3.style="display:block";
ce1.style="display:none";
}
</script>
2.然后在index.php中进行sql查询并且将值传到后边
在index.php中搜索到这些代码if (!$smarty->is_cached('index.dwt', $cache_id))在这里边进行sql查询
$sql="select * from ecs_brand";
$add = $db->getAll($sql);
$sqls="select * from".$ecs->table("suppliers");
$adds = $db->getAll($sqls);
$smarty->assign('sqls', $adds);
$smarty->assign('sql', $add);
assign_template();
3.