您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop商品页上一个下一个alt怎么改成商品名称
张津广2023-12-17 23:24:24ecshop商城教程已有人查阅
导读步骤一:修改 goods.php 文件,找到下面这段代码;第2步: 修改模板文件 (以官方默认模板为例) /themes/default/goods.dwt,将
步骤一:修改 goods.php 文件,找到下面这段代码
/* 上一个商品下一个商品 */
$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");
if (!emptyempty($prev_gid))
{
$prev_good['url'] = build_uri('goods', array('gid' => $prev_gid), $goods['goods_name']);
$smarty->assign('prev_good', $prev_good);//上一个商品
}
$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");
if (!emptyempty($next_gid))
{
$next_good['url'] = build_uri('goods', array('gid' => $next_gid), $goods['goods_name']);
$smarty->assign('next_good', $next_good);//下一个商品
}
然后将它修改为下面代码
/* 上一个商品下一个商品 */ $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");
if (!emptyempty($prev_gid))
{
$prev_good['url'] = build_uri('goods', array('gid' => $prev_gid['goods_id']), $goods['goods_name']);
$prev_good['goods_name'] =$prev_gid['goods_name'];
$smarty->assign('prev_good', $prev_good);//上一个商品
}
$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");
if (!emptyempty($next_gid))
{
$next_good['url'] = build_uri('goods', array('gid' => $next_gid['goods_id']), $goods['goods_name']);
$next_good['goods_name'] =$next_gid['goods_name'];
$smarty->assign('next_good', $next_good);//下一个商品
}
第2步: 修改模板文件 (以官方默认模板为例) /themes/default/goods.dwt,将
<a href="{$prev_good.url}"><img alt="prev" src="./images/up.gif" /></a>
修改为:
<a href="{$prev_good.url}"><img alt="{$prev_good.goods_name}" src="./images/up.gif" /></a>
再将
<a href="{$next_good.url}"><img alt="next" src="./images/down.gif" /></a>
修改为
<a href="{$next_good.url}"><img alt="{$next_good.goods_name}" src="./images/down.gif" /></a>
本文标签:
很赞哦! ()
相关文章
随机图文
-
ecshop验证码图片无法显示解决办法
客户在安装好ecshop之后所有前台的证码不显示,后台可以显示,ECSHOP开发中心总结了解决办法分享给各位朋友。 -
ecshop会员中心您还没有通过邮件认证的删除方法
下面修改方法是以官方默认模板为例的,如果您使用的是其他模板,请搜索 {$lang.not_validated}或{$lang.resend_hash_mail}也能找到对应的代码。 -
ecshop支付宝支付电脑端和手机端支付宝支付设置配置教程
欢迎大家来到代码号,今天代码号图解ecshop支付宝支付:电脑端和手机端支付设置配置教程希望对大家设置ecshop支付宝支付有所帮助。 -
ecshop显示当前商品分类或显示下级分类函数
/* 判断当前分类中全是是否是底级分类, 如果是取出底级分类上级分类, 如果不是取当前分类及其下的子分类 */
留言与评论 (共有 条评论) |