A5下载 - 努力做内容最丰富最安全的下载站!

A5站长下载站

当前位置:A5下载 > 源码技巧 > Ecshop > ecshop获取点击人气排行榜

ecshop获取点击人气排行榜

时间:2015-10-14 15:01作者:fang人气:128

关于ecshop获取点击人气排行榜,具体如下:

两部分。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;

}

以上就是本文章全部内容,希望对大家有所帮助。

标签ecshop,获取,点击,人气,排行榜,关于,ecshop

相关下载

查看所有评论+

网友评论

网友
您的评论需要经过审核才能显示

公众号