我直接写上操作步骤吧,看下思路,相信大家也会了
第一步:
在includes/lib_goods.PHP里面构建自定义函数
代码如下:@H_403_8@
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;
}
@H_403_8@
第二步:
在根目录的goods.PHP的$smarty->assign('goods_rank',get_goods_rank($goods_id)); // 商品的销售排名