您现在的位置是:首页 > 教程 > 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商品图片批量处理方法模糊的处理方法
很多人反映自己商城商品图片很模糊,其实和大家设置缩略图大小有关系,首先要看自己模板缩略图和商品详细页面CSS大小 是多少,然后在设置时间缩略图大小商店设置 -
ecshop怎么样合并商品分类
这是一个基本操作的问题。有人问起这样的问题:如何合并商品分类,例如将A类商品合并到B类? -
ecshop商品详细页的商品描述中显示商品属性的方法
在这介绍一下如何把商品属 调用进商品描述里:其实很简单,首先打开ECSHOP模板文件找到goods.dwt直接在{$goods.goods_desc}下边增加一段代码就OK了 -
ecshop商城会员注册怎么实现注册自动发送邮件
从数据库入手 用mysql管理工具找到 ecs_mail_templates 表插入一条 注册发送邮件的数据template_content 是邮件发邮件内容字段 根据自己的需要编辑不同的内容 当然等你添加成功后
留言与评论 (共有 条评论) |