ECSHOP商品页优化_将上一个下一个的ALT改为商品名称
2016-07-07 15:11 来源:www.chinab4c.com 作者:ecshop专家
第1步:修改 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步: 修改ecshop模板文件(以官方默认模板为例)/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> 本文转载自http://www.ecshop.co/article-725.html |
最近更新
常用插件
- ecshop会员中心订单excel倒出
ecshop会员中心订单excel倒出...
- ecshop二次开发商品购买备
ecshop销售统计 插件介绍:ecshop二次开发订单销售统计和商品购买备注服...
- ecshop注册推荐送现金插件
ecshop中的促销售功能还不是很完善,随着电子商务系统的发展和进步,...
- ecshop2.7.2退换货申请插件
ecshop2.7.2退换货申请插件,主要是在 ecshop 现在的基础上,对ecshop的订单处...
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
ecshop热门问答
ecshop热门资料
ecshop套红
ecshop快速购买
ecshop2.7.1整合
ecshop欧酷
ecshop清晰
ecshop姓名
ecmall订购记录
ecshop收获
ecshop补丁下载
ecshopget_shop_help
ecshopupdate
ecshop搞掂
ecshop排除
ecshopPICTURE
ecshopglobai
ecshop购物车商品选择结算
ecshop遗憾
ecshop评论采集
ecshop潮流前线
ecshop继续购物
ecshop相框
ecshop置顶
ecshop皇明
ecshop插入
ecshop免费客服代码
ecshop填发
ecshophotmail
ecshop马萨
ecshop查询数据库失败
ecshop感激不尽