ecshop在楼层中调用二级分类LOGO
在多用户的ecshop中,是可以进行二级分类LOGO图的设置的,而在做模板的时候,我们有时候又需要在楼层中将二级分类LOGO图调用出来,那么就需要我们在写楼层的时候调用商品的分类名称等相关信息的时候,一并将LOGO图进行调用出来,然后在引用的地方调其路径即可,下面是小虎博客实例方法,如下.
[code lang="php"]
function get_child_cat( $tree_id = 0, $num = 0 )
{
$three_arr = array( );
$sql = "SELECT count(*) FROM ".$GLOBALS['ecs']->table( "category" ).( " WHERE parent_id = '".$tree_id."' AND is_show = 1 " );
if ( 0 < $num )
{
$where = " limit ".$num;
}
if ( $GLOBALS['db']->getOne( $sql ) || $tree_id == 0 )
{
$child_sql = "SELECT cat_id, cat_name, parent_id,thumb,is_show FROM ".$GLOBALS['ecs']->table( "category" ).( "WHERE parent_id = '".$tree_id."' AND is_show = 1 ORDER BY sort_order ASC, cat_id ASC {$where}" );
$res = $GLOBALS['db']->getAll( $child_sql );
foreach ( $res as $row )
{
if ( $row['is_show'] )
{
$three_arr[$row['cat_id']]['id'] = $row['cat_id'];
$three_arr[$row['cat_id']]['thumb'] = $row['thumb'];
$three_arr[$row['cat_id']]['name'] = $row['cat_name'];
$three_arr[$row['cat_id']]['url'] = build_uri( "category", array(
"cid" => $row['cat_id']
), $row['cat_name'] );
}
}
}
return $three_arr;
}
[/code]
在楼层中调用二级分类LOGO图片的路径就变成为了:
[code lang="php"]
<img src="data/catthumb/{$cat_item.thumb}">;
[/code]