ecshop首页调用团购信息产品购买人数

寡言难瘾 分享 2020-06-22 下载文档

Ecshop首页调用团购信息产品购买人数

ECSHOP开发中心(68ecshop.com)

当我们在ecshop后台录入ecshop的团购信息之后,我们在ecshop的前台首页index.php里面,可以看到他能调用ecshop的团购商品信息,其中就包括团购商品的一些价格信息。但是如何在ecshop首页调用团购产品的购买数量呢。我们将结合以下代码,来调用数据。 1:index.php

function index_get_group_buy() {

$time = gmtime();

$limit = get_library_number('group_buy', 'index'); $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 ' .

\\\\\\\

$res = $GLOBALS['db']->query($sql);

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);

$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; } }

return $group_buy_list; }

在这个函数里面,我们调用了$stat = group_buy_stat($row['group_buy_id'],

$ext_info['deposit']);方法,这样一来我们就可以知道每个团购商品他的一些销售情况。

然后在模板里面。直接这样调用就可以

{$goods1.vn} 件

【ECSHOP开发中心】


ecshop首页调用团购信息产品购买人数 .doc 将本文的Word文档下载到电脑

下一篇:2020年《临床助理医师》复习题(九)

相关推荐
相关阅读
本类排行
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 7

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xxxxxx QQ:xxxxxx