给ECShop添加最新评论
2015-01-07 00:00
351 查看
我直接写上操作步骤吧,看下思路,相信大家也会了
第一步:
在includes/lib_goods.php里面构建自定义函数
第二步:
在根目录的goods.php的$smarty->assign('goods_rank', get_goods_rank($goods_id)); // 商品的销售排名
下面添加以下代码
第三步:
在library目录下创建comments_latest.lbi文件
第四步:
在模板文件goods.dwt中使用以下代码即可在商品详情页面中调用“最新评论”
第一步:
在includes/lib_goods.php里面构建自定义函数
/** * 获取最近评论 * * @return array */ function get_latest_comment($limit_num) { $sql = "SELECT c.content,c.add_time,g.goods_id,g.goods_name FROM ".$GLOBALS['ecs']->table('comment')." AS c LEFT JOIN ".$GLOBALS['ecs']->table('goods')." AS g on c.id_value=g.goods_id WHERE c.status=1 LIMIT ".$limit_num; $res = $GLOBALS['db']->getAll($sql); return $res; }
第二步:
在根目录的goods.php的$smarty->assign('goods_rank', get_goods_rank($goods_id)); // 商品的销售排名
下面添加以下代码
$smarty->assign('comments_latest', get_latest_comment(10)); //获取最新品论
第三步:
在library目录下创建comments_latest.lbi文件
第四步:
在模板文件goods.dwt中使用以下代码即可在商品详情页面中调用“最新评论”
<!-- #BeginLibraryItem "/library/comments_latest.lbi" --><!-- #EndLibraryItem -->
相关文章推荐
- ECShop添加自定义模块:最新评论
- 给ECShop添加最新评论
- ECSHOP首页调用最新评论
- ecshop二次开发:添加最新交易滚动显示功能
- ECSHOP添加最新出售商品交易滚动显示功能
- ECSHOP首页添加最新交易滚动显示功能
- ecshop首页最新评论的调用
- ECSHOP 商品页详情页 添加同类随机商品
- IOS使用XMPP最新教程(五)添加好友和接受好友请求
- 为 hexo NexT 添加 Gitment 评论插件
- 如何添加个性的博客评论头像?
- Android:一个TextView分段改变样式、添加监听事件的实现方式(类似朋友圈评论)
- 给wordpress最新文章添加“new”标记
- 【原创】ECshop会员添加权限的开发教程
- 2017最新||Genym b911 otion在eclipse和Android studio中的插件添加
- ecshop二次开发--购物时为每件商品添加备注信息
- ECShop网站 用360浏览器无法添加产品进购物车
- Hi3531添加16GByte(128Gbit) NAND Flash支持 分类: HI3531 2013-08-28 10:23 861人阅读 评论(0) 收藏
- Ecshop最新版v.272本地包含漏洞Oday
- 请问ECSHOP首页站内快讯在哪里添加和修改?