ECshop 点击人气排行榜
点击人气排行榜。。。。hacks by xoao.com
hacks by xoao.com
两部分。index.php和lib_goods.php
关于涉及到index.dwt的,请将按销量排行的改为from = top_hots_all
index.php增加
- $smarty->assign('top_hots_all', get_top10_hot(0)); // 全部人气排行
- /**
- lib_goods.php lib库增加函数(children取得子类产品id)
- * 调用当前人气排行榜
- *按点击排列 i<10 显示10个
- * @access public
- * @param string $cats 查询的分类
- * @return array
- */
- function get_top10_hot($cats)
- {
- if (empty($cats))
- {
- $children = '';
- }
- else
- {
- $children = "WHERE ".get_children($cats);
- }
- $sql = 'SELECT * ' .
- ' FROM ' . $GLOBALS['ecs']->table('goods') .' g '.
- " $children" .
- ' ORDER BY click_count DESC LIMIT 0 , 10';
- $hot = $GLOBALS['db']->getALL($sql);
- for ($i = 0; $i < 10; $i++)
- {
- $hot[$i]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
- sub_str($hot[$i]['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $hot[$i]['goods_name'];/*$hot[$i]['goods_name'];*/
- $hot[$i]['url'] = build_uri('goods', array('gid' => $hot[$i]['goods_id']), $hot[$i]['goods_name']);
- $hot[$i]['name'] = $hot[$i]['goods_name'];
- }
- return $hot;
- }
如果你是第一次来这儿,欢迎订阅
RSS feed。 第一时间看到更多精彩内容,谢谢你的访问!
原文地址:http://my.xoao.com/top-order-by-click
转载请注明出处,非常感谢!
admin on 01月 20th, 2008 | File Under PHP | -
原文地址:http://my.xoao.com/top-order-by-click
转载请注明出处,非常感谢!
01月 20th, 2008 at 3:48 pm
Jet,能不能给个演示出来看看啊
01月 21st, 2008 at 10:10 am
@yiyix:
等全部完工了,给你演示哦~嘿嘿。
01月 24th, 2008 at 10:32 am
好的,谢谢了
03月 14th, 2008 at 12:00 pm
我需要这个功能,但是不是很明白你说的,具体怎么改,可以和我说说吗。
QQ 8984391
04月 7th, 2008 at 9:36 pm
好像我说的很明白了啊?还有什么地方不明白的呢?