您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop商品描述页上一个下一个alt怎么改为商品名称
符彬政2023-12-10 22:55:25ecshop商城教程已有人查阅
导读步骤一:修改 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 (!empty($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 (!empty($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 (!empty($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 (!empty($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文章分类页面调用文章内容简介
打开includes/lib_article.php文件红部分为添加的部分然后在模板文件里调用文章的内容。标签:{$article.content} -
ecshop订单列表订单状态介绍
订单列表主要是将 ECShop 商城系统里的用户的所有订单进行的排列订单列表主要把订单里的一些信息进行表格化的罗列 -
如何让ecshop后台添加完商品后默认不上架
ECSHOP系统默认的情况是这样的:后台添加完商品后,商品状态就变成了“已上架”。现在出于某种考虑,我想让商品添加完后暂时为“未上架”状态。 -
ecshop商品页购买记录显示商品属性
如果某个商品有好几个颜 ,正好赶上有个买家各种颜 都买了1个,而ECSHOP默认的销售记录没有属 这一项,这样就会出现连续好几条购买记录都是同一个买家的,让人看着不舒服。
留言与评论 (共有 条评论) |