如何实现商品列表页属性筛选区品牌筛选以LOGO形式展示,最模板总结ecshop教程入下:
1、修改 category.php 文件,将(大概215行)
$sql = "SELECT b.brand_id,b.brand_logo, b.brand_name, COUNT(*) AS goods_num ".
在(大概227行)
$brands[$temp_key]['brand_name'] = $val['brand_name'];
下面增加
$brands[$temp_key]['brand_logo'] = $val['brand_logo'];
在(大概242行)
$brands[0]['brand_name'] = $_LANG['all_attribute'];
下面增加
$brands[0]['brand_logo']='';
2、修改 category.dwt 文件将
<span>{$brand.brand_name}</span>
修改为
<span>{if $brand.brand_logo}<img src="/data/brandlogo/{$brand.brand_logo}" width="40px" height="40px">{else}{$brand.brand_name}{/if}</span>
将
<a href="{$brand.url}">{$brand.brand_name}</a>
修改为
<div class="akl" style="margin-left:2px;min-height:0px; margin-top:5px; width:178px; height:60px; border:1px dotted #009900;
display: -moz-inline-stack;
display: inline-block; vertical-align:bottom;text-align:center;
zoom:1;
*display:inline;
"><a href="{$brand.url}" style="">{if $brand.brand_logo}<img src="data/brandlogo/{$brand.brand_logo}" width="172" height="60" >{else}{$brand.brand_name}{/if}</a></div>
3.添加CSS样式
div.akl:hover{filter:alpha(opacity=50);
-moz-opacity: 0.5;
opacity: 0.5;
}
4.完成,修ecshop品牌筛选以LOGO图片形式显示 !