© 2002-2018 最模板 zuimoban.com 版权所有,并保留所有权利。
ecshop模板网,专注ecshop模板制作、ecshop二次开发服务!
1 | /** |
2 | * 获得积分商城热门商品 |
3 | * |
4 | * @param int $limit 列出条数 |
5 | * @param int $ishot 是否只显示热销 |
6 | * @return array |
7 | */ |
8 | function index_get_exchange($limit=3,$ishot=0){ |
9 | /* 获得热门积分商品列表 */ |
10 | $sql_ishot = $ishot ? " AND eg.is_hot=1 " : ""; |
11 | $table_exchange_goods = $GLOBALS['ecs']->table('exchange_goods'); |
12 | $table_goods = $GLOBALS['ecs']->table('goods'); |
13 | $sql = " |
14 | SELECT |
15 | g.goods_id, g.goods_name, g.goods_name_style, eg.exchange_integral, |
16 | g.goods_type,g.goods_brief, g.goods_thumb, g.goods_img, eg.is_hot |
17 | FROM $table_exchange_goods AS eg |
18 | LEFT JOIN $table_goods AS g |
19 | ON g.goods_id = eg.goods_id |
20 | WHERE eg.is_exchange = 1 AND g.is_delete = 0 $sql_ishot |
21 | limit $limit |
22 | "; |
23 | $res = $GLOBALS['db']->getAll($sql); |
24 | $arr = array(); |
25 | foreach($res AS $idx => $row){ |
26 | $arr[$idx]['name'] = $row['goods_name']; |
27 | $arr[$idx]['goods_brief'] = $row['goods_brief']; |
28 | $arr[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']); |
29 | $arr[$idx]['exchange_integral'] = $row['exchange_integral']; |
30 | $arr[$idx]['type'] = $row['goods_type']; |
31 | $arr[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); |
32 | $arr[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); |
33 | $arr[$idx]['url'] = build_uri('exchange_goods',array('gid'=>$row['goods_id']), $row['goods_name']); |
34 | } |
35 | return $arr; |
36 | } |
<完>