请问ecshop首页调用团购产品的问题
functionindex_get_group_buy(){$time=gmtime();$limit=get_library_number('group_buy','i...
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, gb.group_rs,gb.isg_rs,gb.start_time, gb.end_time,g.market_price,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);
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);
/*新团购模板加入 时间倒计时 */
$row['gmt_end_date'] = $row['end_time'];
if ($time >= $row['start_time'] && $time <= $row['end_time'])
{
$row['gmt_end_time'] = local_date('M d, Y H:i:s',$row['end_time']);
}
else
{
$row['gmt_end_time'] = 0;
}
/* 根据价格阶梯,计算最低价 */
$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['valid_goods'] = $stat['valid_goods'];
$row['last_price'] = 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'],'');
$row['market_price'] = $row['market_price'];
$row['s_price'] = $row['market_price']-end($price_ladder);
$row['isg_rs'] = $row['isg_rs'];
$row['group_rs'] = $row['group_rs'];
$group_buy_list[] = $row;
}
}
return $group_buy_list;
但是团购活动中的产品不显示 展开
{
$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, gb.group_rs,gb.isg_rs,gb.start_time, gb.end_time,g.market_price,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);
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);
/*新团购模板加入 时间倒计时 */
$row['gmt_end_date'] = $row['end_time'];
if ($time >= $row['start_time'] && $time <= $row['end_time'])
{
$row['gmt_end_time'] = local_date('M d, Y H:i:s',$row['end_time']);
}
else
{
$row['gmt_end_time'] = 0;
}
/* 根据价格阶梯,计算最低价 */
$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['valid_goods'] = $stat['valid_goods'];
$row['last_price'] = 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'],'');
$row['market_price'] = $row['market_price'];
$row['s_price'] = $row['market_price']-end($price_ladder);
$row['isg_rs'] = $row['isg_rs'];
$row['group_rs'] = $row['group_rs'];
$group_buy_list[] = $row;
}
}
return $group_buy_list;
但是团购活动中的产品不显示 展开
2个回答
展开全部
你可以找下技术开发人员帮你看下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
深圳神光
2024-10-21 广告
2024-10-21 广告
深圳市神光数据技术有限公司于 2021 年创立,位于深圳,是认定的SPN和AAPN电商服务商。神光中国公司成立至今,已经成功为10000+跨境卖家提供服务。自2080年开始,我们了解到沃尔玛在电商领域的庞大潜能与细分市场的独特需求,决定结合...
点击进入详情页
本回答由深圳神光提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询