首页调用团购购买数量剩余时间
2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家
| index.php /** * 获得最新的团购活动 * * @accessprivate * @returnarray */ 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,gb.end_time ' . '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); $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); //$smarty->assign('now_time',gmtime());// 当前系统时间 $row['gmt_now_date']= $group_buy['end_date'];// 当前时间 //$row['gmt_now_date'] = format_time($row['end_date']);// 当前时间 $row['gmt_end_date'] = $row['end_time'];// 结束时间 $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; } library/group_buy.lbi <meta http-equiv="Content-Type" content="text/html; charset=gbk"> <script type="text/javascript" src="js/lefttime.js"></script> <!-- {if $group_buy_goods} --> <div class="box" style="border:1px solid #e2e2e2; width:198px;"> <h3><span>{$lang.group_buy_goods}</span></h3> <div class="box_1" style="border:none;"> <div class="boxCenterList clearfix"> <!--{foreach from=$group_buy_goods item=goods}--> <ul class="clearfix" style="position:relative;"> <li class="goodsimg" style="width:190px; height:190px; margin:0px;"><a style=" margin:0px;width:190px; height:190px;" href="{$goods.url}"><img src="{$goods.thumb}" alt="{$goods.goods_name|escape:html}" class="goodsimg" style=" margin:0;width:190px; height:190px;" /></a></li> <li style="text-align:center; width:200px; overflow:hidden; font-size:14px; font-weight:bold;"><a href="{$goods.url}" title="{$goods.goods_name|escape:html}">{$goods.short_style_name|escape:html}</a></li> <li style="width:100%;"><font class="shop_s">{$goods.last_price}</font></li> <div class="index_group">售出 <strong>{$goods.vn}</strong> 件</div> 剩余时间:<span id="leftTime">结束时间:{$goods.gmt_end_date}</span> </ul> <!--{/foreach}--> </div> </div> </div> <div class="blank"></div> <!-- {/if} --> <script type="text/javascript"> var gmt_end_time = "{$goods.gmt_end_date|default:0}"; {foreach from=$lang.goods_js item=item key=key} var {$key} = "{$item}"; {/foreach} var now_time = "{$goods.gmt_now_date|default:0}"; <!-- {literal} --> onload = function() { try { onload_leftTime(); } catch (e) {} } <!-- {/literal} --> </script> | 
回答:
| 看的眼花。 ECSHOP学习资料:http://www.phpally.com | 
 
        
					
						
					
					
						
                          
					
				 
      
      最近更新
常用插件
- ecshop商品分类名称增加样
                                  ecshop插件介绍:本插件可以方便在后台管理,为ecshop商品分类名称增加样... 
- ecshop分类批量扩展插件
                                  ecshop分类批量扩展插件,这个插件是ecshop插件里面比较核心的插件。我们... 
- ecshop二次开发详细页面生
                                  插件介绍: ECSHOP系统,在很多时候,很多商品没有人购买,不但购买的人... 
- ecshop二次商品订购人信息
                                  ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的... 
- ecshop2.7.1打印发货单插件
                                  ecshop2.7.1打印发货单插件介绍:ecshop2.7.1和以前的ecshop版本不一样,ecs... 
ecshop热门问答
ecshop热门资料
          
               
            ecshop最低价 
                
            ecshop销售记录 
                
            ecshop负载 
                
            ecshop自动回复 
                
            ecshop类名 
                
            ecshopICO 
                
            ecshopforeach分析 
                
            ecshopgodaddy 
                
            ecshop前台 
                
            dede模板 
                
            ecshop商务部 
                
            ecshop数据表 
                
            ecshop订单实时通知 
                
            ecshop虚拟点卡 
                
            ecshopCSV 
                
            ecshop网页抽奖程序 
                
            ecshopECMALL插件 
                
            ecshopspec 
                
            ecshop天下 
                
            ecshop图片格式 
                
            ecshop1号店 
                
            ecshop批发功能 
                
            ecshop绿卡 
                
            ecshopwinserver 
                
            ecshop注销 
                
            ecshop弟弟 
                
            ecshop毕?? 
                
            ecshop色调 
                
            ecshop222 
                
            ecshopExplorer 
             
        
      


