ecshop首页怎样可以显示所有促销商品

 我来答
秋水萍水相逢
2015-06-05 · 超过15用户采纳过TA的回答
知道答主
回答量:47
采纳率:0%
帮助的人:23万
展开全部
二)、首页限时抢购调用以及剩余时间显示
1、首先修改程序部分
打开includes/lib_goods.php
找到get_promote_goods()函数部分
在 $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
下面增加代码
$time = gmtime();
if ($time >= $row['promote_start_date'] && $time <= $row['promote_end_date'])
{
$goods[$idx]['gmt_end_time'] = local_date('M d, Y H:i:s',$row['promote_end_date']);
}
else
{
$goods[$idx]['gmt_end_time'] = 0;
}
2、
然后将 library/recommend_promotion.lbi
全部替换为下面代码:

<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<!-- {if $promotion_goods} -->
<script >
var Tday = new Array();
var daysms = 24 * 60 * 60 * 1000
var hoursms = 60 * 60 * 1000
var Secondms = 60 * 1000
var microsecond = 1000
var DifferHour = -1
var DifferMinute = -1
var DifferSecond = -1
function clock(key)
{
var time = new Date()
var hour = time.getHours()
var minute = time.getMinutes()
var second = time.getSeconds()
var timevalue = ""+((hour > 12) ? hour-12:hour)
timevalue +=((minute < 10) ? ":0":":")+minute
timevalue +=((second < 10) ? ":0":":")+second
timevalue +=((hour >12 ) ? " PM":" AM")
var convertHour = DifferHour
var convertMinute = DifferMinute
var convertSecond = DifferSecond
var Diffms = Tday[key].getTime() - time.getTime()
DifferHour = Math.floor(Diffms / daysms)
Diffms -= DifferHour * daysms
DifferMinute = Math.floor(Diffms / hoursms)
Diffms -= DifferMinute * hoursms
DifferSecond = Math.floor(Diffms / Secondms)
Diffms -= DifferSecond * Secondms
var dSecs = Math.floor(Diffms / microsecond)

if(convertHour != DifferHour) a="<font color=red>"+DifferHour+"</font>天";
if(convertMinute != DifferMinute) b="<font color=red>"+DifferMinute+"</font>时";
if(convertSecond != DifferSecond) c="<font color=red>"+DifferSecond+"</font>分"
d="<font color=red>"+dSecs+"</font>秒"
if (DifferHour>0) {a=a}
else {a=''}
document.getElementById("leftTime"+key).innerHTML = a + b + c + d; //显示倒计时信息
}
</script>
<div id="sales" class="f_l clearfix">
<h1><a href="../search.php?intro=promotion"><img src="images/more.gif" /></a></h1>
<div class="clearfix goodBox">
<!--{foreach from=$promotion_goods key=key item=goods name="promotion_foreach"}-->
<div class="goodList">
<a href="{$goods.url}"><img src="{$goods.thumb}" border="0" alt="{$goods.name|escape:html}"/></a><br />
<p><a href="{$goods.url}" title="{$goods.name|escape:html}">{$goods.short_name|escape:html}</a></p>
{$lang.promote_price}<font class="f1">{$goods.promote_price}</font><br><font class="f4" id="leftTime{$key}">{$lang.please_waiting}</font>
</div>
<script>
Tday[{$key}] = new Date("{$goods.gmt_end_time}");
window.setInterval(function()
{clock({$key});}, 1000);
</script>
<!--{/foreach}-->
</div>
</div>
<!-- {/if} -->
这是我自己整理的促销调用,有倒计时功能的,如果不需要就删了那段代码就可以了。
追问
热心的道友, 可以全部显示吗, 提供网站看下可以吗
追答
网站在本地,暂时看不到,你要自己试一下你才知道怎么用撒,我跟你说那么多也没用呀
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式