很多时候ecshop分类页的品牌都是以名称的形式显示的,下面ECSHOP开发中心的技术和大家说说ecshop 如何实现商品列表页属性筛选区品牌筛选以LOGO形式展示
1、修改 category.php 文件,将(大概220行)
找到
1
|
$sql
=
"SELECT b.brand_id, b.brand_name, COUNT(*) AS goods_num "
.
|
替换成
1
|
$sql
=
"SELECT b.brand_id,b.brand_logo, b.brand_name, COUNT(*) AS goods_num "
.
|
2、在(大概232行)
找到
1
|
$brands
[
$temp_key
][
'brand_name'
] =
$val
[
'brand_name'
];
|
在它下面增加
1
|
$brands
[
$temp_key
][
'brand_logo'
] =
$val
[
'brand_logo'
];
|
3、在(大概242行或246行)
找到
1
|
$brands
[0][
'brand_name'
] =
$_LANG
[
'all_attribute'
];
|
在它下面增加
1
|
$brands
[0][
'brand_logo'
]=
''
;
|
4、修改 category.dwt 文件 查找
1
|
<span>{
$brand
.brand_name}</span>
|
替换成:
1
2
|
<span>{
if
$brand
.brand_logo}<img src=
"/data/brandlogo/{$brand.brand_logo}"
width=
"40px"
height=
"40px"
>
{
else
}{
$brand
.brand_name}{/
if
}</span>
|
5、继续找到
1
|
<a href=
"{$brand.url}"
>{
$brand
.brand_name}</a>
|
替换成
1
2
3
4
|
<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>
|
注:第5步品牌的logo 大小已经定义,width=172 height=60; 可自行调整自己想要的logo的大小,依你自身的情况而定
6、添加CSS样式 打开style.css 将下面一段代码放在它的底部
1
2
3
4
|
div.akl:hover{filter:alpha(opacity=
50
);
-moz-opacity:
0.5
;
opacity:
0.5
;
}
|