ECShop 如何在首页调用用户商品评论
2016-07-07 15:11 来源:www.chinab4c.com 作者:ecshop专家
| 就是把用户对商品的评论在首页调用,修改模板的哪些地方可以实现?在线等 | 
回答:
| 有点麻烦的,要改程序代码才行,因为ECSHOP没有调用全部评论的现存代码, | 
| 在首页模板的相应位置即\themes\模板\index.dwt 调用这个库文件就OK了. <!-- #BeginLibraryItem "/library/index_comments.lbi" --><!-- #EndLibraryItem --> 这个库文件是调用用户对商品的评论的 | 
| 加一个文件:index_comments.lbi <?php if(!function_exists("get_comments")){ function get_comments($num) { $sql = 'SELECT * FROM '. $GLOBALS['ecs']->table('comment') . ' WHERE status = 1 AND parent_id = 0 and comment_type=0 '. ' ORDER BY add_time DESC'; if ($num > 0) { $sql .= ' LIMIT ' . $num; } //echo $sql; $res = $GLOBALS['db']->getAll($sql); $comments = array(); foreach ($res AS $idx => $row) { $comments[$idx]['add_time'] = $comments[$idx]['add_time'] = local_date ($GLOBALS['_CFG']['time_format'], $row['add_time']); $comments[$idx]['user_name'] = $row['user_name']; $comments[$idx]['content'] = $row['content']; $comments[$idx]['id_value'] = $row['id_value']; } return $comments; } } ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--数据调用-最新评论开始 --> <?php $this->assign('my_comments',get_comments(10)); // 10条数据 ?> <div class="comments"> <!--{foreach from=$my_comments item=comments}--> <div class="t_l f_l"><a href="goods.php?id={$comments.id_value}" target="_blank"> {$comments.content|truncate:15:""}</a></div><div class="d_r f_r">时间: {$comments.add_time}</div> <!--{/foreach}--> </div> 修改相应的css样式,即可调整样式。 | 
| 楼上强大。。www.51php.com | 
| 这个有点难,需要懂程序才行 | 
| 不懂,帮D下 | 
| 2楼很强大  | 
| 不行,按你说的做了,显示这个 table('comment') . ' WHERE status = 1 AND parent_id = 0 and comment_type=0 '. ' ORDER BY add_time DESC'; if ($num > 0) { $sql .= ' LIMIT ' . $num; } //echo $sql; $res = $GLOBALS['db']->getAll($sql); $comments = array(); foreach ($res AS $idx => $row) { $comments[$idx]['add_time'] = $comments[$idx]['add_time'] = local_date ($GLOBALS['_CFG']['time_format'], $row['add_time']); $comments[$idx]['user_name'] = $row['user_name']; $comments[$idx]['content'] = $row['content']; $comments[$idx]['id_value'] = $row['id_value']; } return $comments; } } ?> assign('my_comments',get_comments(10)); // 10条数据 ?>聽 | 
| 这个我也想知道,试试看效果如何 | 
| 用了一下感觉还能调用,不会技术只有在论坛找教程了 | 
| 最新版本的不可以在模板中使用php. 帮忙整理一下: 打开index.php 1. 查找:判断是否存在缓存,如果存在则调用缓存,反之读取相应内容, 看到下面有$smarty->assign这些的,如: 
 在下面添加一行: 
 2. 在最下面, ?> 标签前添加: 
 3. 打开index.dwt 然后在所需要位置添加如下代码: 
 这样就可以了 | 
| 很好很强大 ,可是怎么能调用出来商品图片呢 | 
 
        
					
						
					
					
						
                          
					
				 
      
      最近更新
常用插件
- ecshop二次开发商品购买备
                                  ecshop销售统计 插件介绍:ecshop二次开发订单销售统计和商品购买备注服... 
- ecshop二次商品订购人信息
                                  ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的... 
- ecshop会员中心订单excel倒出
                                  ecshop会员中心订单excel倒出... 
- ecshop2.7.2退换货申请插件
                                  ecshop2.7.2退换货申请插件,主要是在 ecshop 现在的基础上,对ecshop的订单处... 
- ecshop注册推荐送现金插件
                                  ecshop中的促销售功能还不是很完善,随着电子商务系统的发展和进步,... 
ecshop热门问答
ecshop热门资料
          
               
            ecshop补丁下载 
                
            ecshop重写 
                
            ecshop火狐浏览器 
                
            ecshopheader 
                
            ecshop乐淘 
                
            ecshop白名单 
                
            ecshop品牌网站建设 
                
            ecshop序列 
                
            ecshop服务端 
                
            ecshop订单汇总 
                
            ecshop文章 
                
            ecshop产品评论 
                
            ecshop定向 
                
            ecshop免费模板 
                
            ecshop香港电器街 
                
            ecshop中国社会 
                
            ecshop清理缓存 
                
            ecshop在线测试 
                
            ecshop重量 
                
            ecshop操作按钮 
                
            ecshopPermanently 
                
            ecshop2.7评论 
                
            ecshop网络连接 
                
            ecshopSportsShoes 
                
            ecshop显示空白 
                
            ecshoppowerde 
                
            ecshop悲剧 
                
            ecshop上海地区 
                
            ecshop旺旺 
                
            ecshop系统语言 
             
        
      


