关于在ECShop首页显示积分商城里的商品列表方法
2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家
在ECShop首页显示积分商城里的商品列表方法,一、在 index.php 末尾添加一个 function:
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 | } |
二、index.dwt 中的调用代码:
1 |
2 |
|
3 |
4 |
|
5 |
6 |
|
7 |
|
8 |
{$lang.exchange_integral}{$goods.exchange_integral}
|
9 |
10 |
11 |
12 |
13 |
<完>
最近更新
常用插件
- ecshop没登陆情况下订单查
ecshop没登陆情况下订单查询插件,主要是针对ecshop在没有登陆的情况下...
- ecshop2.7.1邮件发送插件
ecshop2.7.1邮件发送插件:该插件主要的开发思想是源于ecshop短信发送系统...
- ecshop最小购买数量控制插
ecshop最小购买数量控制插件,这个插件主要是为我们提供一个十分方便...
- ecshop2.7.2生成虚拟订单2.
以前我们开发过ecshop下的虚拟订单,就是客户在访问的时候,会自动生...
- ecshop二次开发商品购买增
图片1香...
ecshop热门问答
ecshop热门资料
ecshop2.7.1
ecshop个性化
ecshop上當
ecshop市内快递
ecshopget_data
ecshop破格
ecshopEC助理
ecshop锁死
ecshop标识
ecshop重装系统
ecshop大连海参
ecshop高度
ecshoplamiu
ecshop折叠
ecshop光纤通信
ecshopECShopB2C
ecshop站里
ecshop上传图片
ecshop图片被拉长
ecshop技术
ecshop编辑文章
ecshop油滑
ecshoptree
ecshop品种
ecshop爱宠一号店
ecshop还有什么加密啊
ecshop套餐
ecshopmate
ecshop店铺管理
ecshop资费