ecshop首页调用团购信息产品购买人数
2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家
[color=#666666][font=Arial, Helvetica, sans-serif, 宋体]当我们在ecshop后台录入ecshop的团购信息之后,我们在ecshop的前台首页index.php里面,可以看到他能调用ecshop的团购商品信息,其中就包括团购商品的一些价格信息。但是如何在ecshop首页调用团购产品的购买数量呢。我们将结合以下代码,来调用数据。[p=28, 2, left]1:index.php[p=28, 2, left]function index_get_group_buy() { $time = gmtime(); $limit = get_library_number('group_buy', 'index');[p=28, 2, left]$group_buy_list = array(); if ($limit > 0) { $sql = 'SELECT gb.act_id AS group_buy_id, gb.goods_id, gb.ext_info, gb.goods_name, g.goods_thumb, g.goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods_activity') . ' AS gb, ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "WHERE gb.act_type = '" . GAT_GROUP_BUY . "' " . "AND g.goods_id = gb.goods_id " . "AND gb.start_time <= '" . $time . "' " . "AND gb.end_time >= '" . $time . "' " . "AND g.is_delete = 0 " . "ORDER BY gb.act_id DESC " . "LIMIT $limit" ; $res = $GLOBALS['db']->query($sql);[p=28, 2, left]while ($row = $GLOBALS['db']->fetchRow($res)) { $row['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $row['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);[p=28, 2, left] $ext_info = unserialize($row['ext_info']); $stat = group_buy_stat($row['group_buy_id'], $ext_info['deposit']); $price_ladder = $ext_info['price_ladder']; if (!is_array($price_ladder) || empty($price_ladder)) { $row['last_price'] = price_format(0); } else { foreach ($price_ladder AS $amount_price) { $price_ladder[$amount_price['amount']] = $amount_price['price']; } } ksort($price_ladder); $row['vn'] = $stat['valid_goods']; $row['last_price'] = price_format(end($price_ladder)); $row['url'] = build_uri('group_buy', array('gbid' => $row['group_buy_id'])); $row['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $row['short_style_name'] = add_style($row['short_name'],''); $group_buy_list[] = $row; } }[p=28, 2, left]return $group_buy_list; }[p=28, 2, left]在这个函数里面,我们调用了$stat = group_buy_stat($row['group_buy_id'], $ext_info['deposit']);方法,这样一来我们就可以知道每个团购商品他的一些销售情况。[p=28, 2, left]然后在模板里面。直接这样调用就可以 <div class="index_group">售出 <strong>{$goods1.vn}</strong> 件</div> |
最近更新
常用插件
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
- ecshop2.7.1打印发货单插件
ecshop2.7.1打印发货单插件介绍:ecshop2.7.1和以前的ecshop版本不一样,ecs...
- ecshop分类批量扩展插件
ecshop分类批量扩展插件,这个插件是ecshop插件里面比较核心的插件。我们...
- ecshop二次开发详细页面生
插件介绍: ECSHOP系统,在很多时候,很多商品没有人购买,不但购买的人...
- ecshop商品分类名称增加样
ecshop插件介绍:本插件可以方便在后台管理,为ecshop商品分类名称增加样...
ecshop热门问答
ecshop热门资料
ecshop附件
ecshop会员管理
ecshop菜单
ecshop师范大学
ecshop系统
ecshop下脚
ecshop对象
ecshop保驾
ecshop痕迹
ecshop仿京东分类
ecshopechsop
ecshop无法加入购物车
ecshop方法
ecshop易趣
ecshop中国移动
ecshop网站名称
ecshop名牌
ecshop70错误
ecshop抢购
ecshop属性值调用
ecshop都会
ecshop最好的医生是自己
ecshop模板出售
ecshopjiaju
ecshop救火
ecshop汉字
ecshopgoods_brief
mongodb
ecshop压力测试
制作ecshop