关于商品详细页上一个下一个的链接地址带上产品名称
2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家
1,在goods.php文件中,修改上一个下一个位置的代码:
/* 上一个商品下一个商品 */
$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['goods_name'] = $prev_gid['goods_name'];
$prev_good['url'] = build_uri('goods', array('gid' => $prev_gid['goods_id']),$prev_gid['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['goods_name'] = $db -> getOne("select goods_name from ".$ecs->table('goods')." where goods_id =".$next_gid);
$next_good['url'] = build_uri('goods', array('gid' => $next_gid),$next_good['goods_name']);
$smarty->assign('next_good', $next_good);//下一个商品
}
2,在goods.dwt模版文件,在适当的位置加上:
<br><hr color=red>
{if $prev_good}
【上一个礼品】<a href="{$prev_good.url}" title="{$prev_good.goods_name}" >{$prev_good.goods_name}</a>
{/if}<br>
{if $next_good}
【下一个礼品】<a href="{$next_good.url}" title="{$next_good.goods_name}">{$next_good.goods_name}</a>
{/if}
最近更新
常用插件
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
- ecshop二次开发商品购买增
图片1香...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...