在ECShop首页显示积分商城里的商品列表方法,一、在 index.php 末尾添加一个 function:
4 |
* @param int $limit 列出条数 |
5 |
* @param int $ishot 是否只显示热销 |
8 |
function index_get_exchange($limit=3,$ishot=0){ |
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'); |
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 |
23 |
$res = $GLOBALS['db']->getAll($sql); |
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']); |
二、index.dwt 中的调用代码:
8 |
{$lang.exchange_integral}{$goods.exchange_integral}
|
<完>
下一篇: 另类ECShop调用广告位的方法 上一篇: 设置ECShop调试模式详解