在首页增进一个赏识排行

2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家

首页增进一个赏识排行
修改 /includes/lib_goods.php 文件
在最下面增进一个函数
/**
* 挪用赏识排行榜
*
* @accesspublic
* @returnarray
*/
function get_top10_click()
{
$sql="SELECT goods_id, goods_name, shop_price, goods_thumb " .
'FROM ' . $GLOBALS['ecs']->table('goods')." where is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 order by click_count desc limit 10";
$arr = $GLOBALS['db']->getAll($sql);
for ($i = 0, $count = count($arr); $i < $count; $i++)
{
$arr[$i]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
sub_str($arr[$i]['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $arr[$i]['goods_name'];
$arr[$i]['url']= build_uri('goods', array('gid' => $arr[$i]['goods_id']), $arr[$i]['goods_name']);
$arr[$i]['thumb'] = get_image_path($arr[$i]['goods_id'], $arr[$i]['goods_thumb'],true);
$arr[$i]['price'] = price_format($arr[$i]['shop_price']);
}
return $arr;
}
http://xianggll461.com
reishi451.com
abaylec971.com

修改 /index.php 文件

$smarty->assign('top_goods', get_top10());// 贩卖排行

下面另起一行增进
$smarty->assign('top_goods_click', get_top10_click());// 赏识排行