ECSHOP商品页_将上一个下一个的ALT改为商品名称-站长杂谈下载

ECSHOP商品页_将上一个下一个的ALT改为商品名称

来自版块: 站长杂谈发表于: 2015-8-8 23:17:09
39461
0
如本资源下载地址失效,请点击此处进行反馈
开通本站Svip会员,全站资源免费下
第1步:修改 goods.php 文件3 W: S0 c3 @8 q5 H
! \7 @4 G, U4 U3 q0 o
找到下面这段代码
3 }$ V, x& E6 z" s0 }) ~$ H3 X. l' ^3 W( u  x+ q8 {
/* 上一个商品下一个商品 *// W3 C  a8 u0 L" Q$ t6 g3 A( E
        $prev_gid = $db->getOne("SELECT goods_id FROM " .$ecs->table('goods'). " WHERE cat_id=" . $goods['cat_id'] . " AND goods_id > " . $goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1");
8 C) g' S# ?# j# z        if (!empty($prev_gid))
4 U! i8 C9 E% M2 }& J- @+ p- G4 Q* n        {) E& [" a# J/ D8 \$ _1 X
            $prev_good['url'] = build_uri('goods', array('gid' => $prev_gid), $goods['goods_name']);5 r( }+ B) [7 x. J3 S$ {
            $smarty->assign('prev_good', $prev_good);//上一个商品
8 F, M" M5 y; V) h1 E; v, ?        }
        $next_gid = $db->getOne("SELECT max(goods_id) FROM " . $ecs->table('goods') . " WHERE cat_id=".$goods['cat_id']." AND goods_id < ".$goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0");5 D+ y7 p1 c: V. T- G  i
        if (!empty($next_gid)); W& j1 H( V/ w* z
        {6 |6 G4 O% G9 A
            $next_good['url'] = build_uri('goods', array('gid' => $next_gid), $goods['goods_name']);+ u1 B) X  l$ w$ O6 v, D% |: S
            $smarty->assign('next_good', $next_good);//下一个商品& z# r+ `7 L' H9 K
        }

& J( m6 x( ~: J" @" m. r然后将它修改为下面代码(注意红色部分) . G) ?+ `* W/ V2 I. L! ~& ]
! [: K2 l2 q+ g7 l2 m8 H
/* 上一个商品下一个商品 */ # d8 G8 Y" F; I3 x# ~  F+ ~
$prev_gid = $db->getRow("SELECT goods_id,goods_name FROM " .$ecs->table('goods'). " WHERE cat_id=" . $goods['cat_id'] . " AND goods_id > " . $goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1");
1 X) Y! ~  d; J7 ^& N) ~0 I$ B        if (!empty($prev_gid))# e5 b' T4 X3 I) K; f$ s1 o
        {
5 i0 i; r( I3 I% B            $prev_good['url'] = build_uri('goods', array('gid' => $prev_gid['goods_id']), $goods['goods_name']);, y, B$ ~' @! `7 L
            $prev_good['goods_name'] =$prev_gid['goods_name'];
8 X/ e( u/ g: b$ {1 T% N            $smarty->assign('prev_good', $prev_good);//上一个商品
7 a5 ?: h3 A& C2 q, a        }
        $next_gid = $db->getRow("SELECT goods_id,goods_name FROM " . $ecs->table('goods') . " WHERE cat_id=".$goods['cat_id']." AND goods_id < ".$goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 order by goods_id desc limit 1");% f4 |6 @6 V& M! L$ u
        if (!empty($next_gid))
. i$ ?" u- y2 a# u7 ?+ P3 V; @        {
7 l% q7 x7 R& q, H! _, C3 ]            $next_good['url'] = build_uri('goods', array('gid' => $next_gid['goods_id']), $goods['goods_name']);
& i+ y9 G* X8 B2 ?7 k/ c            $next_good['goods_name'] =$next_gid['goods_name'];1 ]* m  m0 ~& v2 q$ r0 T
            $smarty->assign('next_good', $next_good);//下一个商品
" a* q& P6 k8 W% x        }
9 P# S4 N& l, ]% l
第2步: 修改模板文件  (以官方默认模板为例)  /themes/default/goods.dwt / x* X, Z/ r' \

4 T( l: K9 W1 @( W1 u; S7 H/ y
<a href="{$prev_good.url}"><img alt="prev" src="./images/up.gif" /></a>
# L1 `0 s' ~8 `3 ?0 r" J$ x
修改为:" }  d" }3 A' J# m6 {! e1 m) N
<a href="{$prev_good.url}"><img alt="{$prev_good.goods_name}" src="./images/up.gif" /></a>
0 `# ^; E, }  y: l7 Z
再将
<a href="{$next_good.url}"><img alt="next" src="./images/down.gif" /></a>
6 I' V7 g! g2 Q/ s% Y1 u( E2 p
修改为
0 T9 D  x- i( R: u
<a href="{$next_good.url}"><img alt="{$next_good.goods_name}" src="./images/down.gif" /></a>
# d: `/ T2 V) O) A5 B  M

全部评论 0

您需要登录后才可以回帖 立即登录
登录
0
0
0
返回顶部