ECShop添加自定义模块:最新评论
2013-01-04 17:15
253 查看
我直接写上操作步骤吧,看下思路,相信大家也会了
第一步:
在includes/lib_goods.php里面构建自定义函数
第二步:
在根目录的goods.php的$smarty->assign('goods_rank', get_goods_rank($goods_id)); // 商品的销售排名
下面添加以下代码
第三步:
在library目录下创建comments_latest.lbi文件
第四步:
在模板文件goods.dwt中使用以下代码即可在商品详情页面中调用“最新评论”
原创文章,转载请注明出处:/article/4791470.html
第一步:
在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 -->
原创文章,转载请注明出处:/article/4791470.html
相关文章推荐
- 给ECShop添加最新评论
- 给ECShop添加最新评论
- magento如何添加自定义插件(模块
- ecshop添加类似于精品,新品,热销的模块
- 67:zabbix之添加主动/被动模式|添加监控主机|自定义模块|图形中乱码|自动发现
- sharepoint 2010 如何给文档库或自定义列表添加评论功能
- Joomla使用自定义Html模块,并在其中添加PHP代码
- 添加自定义的Python模块方法
- destoon模块自定义字段的添加并让其支持搜索的方法
- ECSHOP 添加自定义动态库项目详解
- 使用Python+XML添加自定义模块
- ecshop 添加自定义动态库项目详解
- ecshop:商品分类页和文章分类页添加自定义分类title,不填为空时默认为当前分类名称
- 在Python中添加自定义模块
- 建站之星 添加自定义模块步骤
- 编译Framework/base 下添加自定义模块的步骤
- shopnc 手机端添加自定义模块
- sharepoint 2010 如何给文档库或自定义列表添加评论功能
- Framework/base 下添加自定义模块的步骤
- Ecshop二次开发:给商品添加自定义字段(三)