垃圾堆中的精品

垃圾堆中的精品

解决ECSHOP促销显示请稍后,正在加载中…

本来要做个倒计时的,结果网上的一搜一大堆,也不知道是谁抄谁的,反正都一样的错误。

 

一行一行找,找到一个

document.getElementByIdx_x(“leftTime”+key)

【x_x】是啥!?!?  感觉像是考验开发者 的…我擦~  这代码写的,惊天地泣鬼神啊,尽然这样开玩笑

 

 

附:修改正确可以运行的操作方法(图片自己换)

 

1.打开include/lib_goods.php文件

在  获得促销商品

function get_promote_goods($cats = ”)
{

的下面找到

$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.打开模板文件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=”<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 =”<img src=’images/clar.gif’ />&nbsp;&nbsp;剩余:”+ a + b + c + d; //显示倒计时信息

}

</script>

<div id=”sales” class=”f_l clearfix”>

      <div class=”clearfix goodBox”>

        <!–{foreach from=$promotion_goods key=key item=goods name=”promotion_foreach”}–>
        {if $smarty.foreach.promotion_foreach.index <= 4}
          <div class=”goodList”>
<font class=”f40″ id=”leftTime{$key}”>{$lang.please_waiting}</font>
          <a href=”{$goods.url}”><img src=”{$goods.thumb}” border=”0″ alt=”{$goods.name|escape:html}”/></a><br />
<font style=”color:#CCCCCC; font-size:12px;”>{$goods.shop_price}</font>
<font class=”f10″>{$goods.promote_price}</font>
<a href=”{$goods.url}” target=”_blank”><img src=”images/qg.gif”></a>
          </div>
        {/if}
<script>

Tday[{$key}] = new Date(“{$goods.gmt_end_time}”);  

window.setInterval(function()    

{clock({$key});}, 1000);    

</script>
        <!–{/foreach}–>
      </div>
     </div>
<!– {/if} –>

评论回复

应监管要求,暂停评论,如有需要联系QQ505097558。

回到顶部