ecshop产品详细页用产品名称替代图片上下翻页
2009-06-11 22:32 来源:www.chinab4c.com 作者:admin
在产品详细页面,可以通过点上一页和下一页来实现产品的翻页,在ec的论坛中,很多朋友都希望把这个功能修改,将上一页和下一页的图片换成产品名称,仔细研究,其实也不难.
在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['url'] = build_uri('goods', array('gid' => $prev_gid['goods_id']));
$prev_good['goods_name'] = $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['url'] = build_uri('goods', array('gid' => $next_gid));
if($next_gid){
$next_good['goods_name'] = $db -> getOne("select goods_name from ".$ecs->table('goods')." where goods_id =".$next_gid);//下一个商品}
}
$smarty->assign('next_good', $next_good);
}
用产品名称代替图片$prev_gid['goods_name'],$next_good['goods_name'] = $db -> getOne("select goods_name from ".$ecs->table('goods')." where goods_id =".$next_gid);
在ecshop模板文件中.找到goods.dwt,修改成下面小代码
<div class="clearfix">
<p class="f_l">{$goods.goods_style_name}</p>
<p class="f_r">
{if $prev_good}
<a href="{$prev_good.url}">{$prev_good.goods_name}</a>
{/if}
{if $next_good}
<a href="{$next_good.url}">{$next_good.goods_name}</a>
{/if}
</p>
</div>
来源:中国B4C电子商务
最近更新
常用插件
- ecshop购物车功能改进[插件
ecshop购物车功能改进[插件套餐]主要是我们最近开发工作和开发项目中。...
- ecshop降价通知登记插件
ecshop降价通知登记插件,主要是为了方便某些客户,对商品价格要求比...
- ecshop分类树中统计商品数
最近忙于开发其他项目,在不少朋友不断要求和催促的情况下,做出了该小...
- ecshop通用红包编码
很多时候,为了结合促销,必须扩展一下ecshop的红包功能。ecshop的红包...
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...