您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop首页今日特价促销商品怎么增加促销倒计时效
丙赣2023-12-12 22:54:23ecshop商城教程已有人查阅
导读 1、打开includes/lib_goods.php找到get_promote_goods()函数部分红字这行之后,添加如下代码(没有修改过的模板,大约在394行)
修改方法:
1、打开includes/lib_goods.php找到get_promote_goods()函数部分,在
全部替换为下面代码:
1、打开includes/lib_goods.php找到get_promote_goods()函数部分,在
$goods[$idx]['url'] =build_uri('goods', array('gid' => $row['goods_id']),$row['goods_name']);
红字这行之后,添加如下代码(没有修改过的模板,大约在394行):
$time = gmtime();
if ($time >= $row['promote_start_date']&& $time <=$row['promote_end_date'])
{
$goods[$idx]['gmt_end_time'] = local_date('M d, YH: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=utf-8">
<!-- {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="剩余:<fontcolor=red>"+DifferHour+"</font>天";
if(convertMinute !=DifferMinute) b="<fontcolor=red>"+DifferMinute+"</font>时";
if(convertSecond !=DifferSecond) c="<fontcolor=red>"+DifferSecond+"</font>分"
d="<fontcolor=red>"+dSecs+"</font>秒"
if (DifferHour>0) {a=a}
else {a=''}
document.getElementByIdx_x("leftTime"+key).innerHTML = a + b + c + d;//显示倒计时信息
}
</script>
<div id="sales" class="f_lclearfix">
<h1><ahref="../search.php?intro=promotion"><imgsrc="images/more.gif"/></a></h1>
<div class="clearfix goodBox">
<!--{foreach from=$promotion_goods key=keyitem=goods name="promotion_foreach"}-->
{if $smarty.foreach.promotion_foreach.index <=3}
<div class="goodList">
<ahref="{$goods.url}"><imgsrc="{$goods.thumb}" border="0"alt="{$goods.name|escape:html}"/></a><br/>
<p><ahref="{$goods.url}"title="{$goods.name|escape:html}">{$goods.short_name|escape:html}</a></p>
{$lang.promote_price}<fontclass="f1">{$goods.promote_price}</font><br><fontclass="f4"id="leftTime{$key}">{$lang.please_waiting}</font>
</div>
{/if}
<script>
Tday[{$key}] = newDate("{$goods.gmt_end_time}");
window.setInterval(function()
{clock({$key});},1000);
</script>
<!--{/foreach}-->
</div>
</div>
<!-- {/if} -->
本文标签:
很赞哦! ()
相关文章
随机图文
-
ecshop商品属性怎么仿淘宝选择功能
经常网友问商品的颜 尺 寸等属 选择,ecshop默认的是下拉菜单和点选两种形式,样式特别不耐看,淘宝选择那种方形的框选已经是主流 -
ecshop商品goods.html怎么自定义URL静态路径
需要改的地方有两个:include/lib_common.php和.htaccess这两个文件:1、找到ecshop并打开include/lib_common.php,找到文件中的build_uri函数。 -
ecshop客服管理不同会员二次开发方法
ecshop不同客服管理不同会员,这个看起来相当有必要,也相当实 用。我们很多人用ecshop做货源批发站。这个就牵涉到一个问题。如果不同的客服 -
ecshop商品品牌图片添加设置教程
今天为大家详细解说一下ECSHOP商品品牌添加设置。你可以直接点击某个品牌的品牌的名称、品牌网址、排序后该区域将变为编辑区。编辑完成回车就完成编辑。
留言与评论 (共有 条评论) |