首页
外贸B2C模板开发
zencart 开发
Magento开发
经典客户案例
zencart 报价
外贸主机
联系我们
 
 
首页 ::  zencart知识 ::  Zen Cart常见问题 ::  zencart促销倒计时(zencart特价倒计时插件)
 
zencart促销倒计时(zencart特价倒计时插件)

  作者: zen cart   |   2015-03-18     阅读次数:794     关键字:浙江zencart优化

zencart促销倒计时(zencart特价倒计时插件)


先上一个效果图下看一下:

1。找到:includesfunctionsfunctions_prices.php 插入以下代码:

======================================================

    //get sale or special price expires time
    function zen_get_promotion_price_time($products_id){
            global $db;
            //specials
            $sql_expires_date = "select expires_date from " . TABLE_SPECIALS . " where products_id = " . $products_id . " and status =1" ;
            //echo $sql_expires_date;
            $expires_date = $db->Execute($sql_expires_date);
            if($expires_date ->RecordCount() > 0){
                    $specials_date_end = $expires_date->fields['expires_date'];
                    }
            $sql_products_mcate = "select master_categories_id from ". TABLE_PRODUCTS . " where products_id = ". (int)$products_id ;
            //echo $sql_products_mcate;
            $procuts_mcate = $db->Execute($sql_products_mcate);
            $sql_sale1 = "select sale_specials_condition, sale_date_end from " . TABLE_SALEMAKER_SALES . " where sale_categories_all like '%," . $procuts_mcate->fields['master_categories_id'] . ",%' and sale_status = 1 order by sale_id limit 1";
                    //echo $sql_sale;
                    $sale1 = $db->Execute($sql_sale1);
                    if($sale1 -> RecordCount() > 0 ){
                            if($sale1->fields['sale_specials_condition'] == 1){
                                     if(!$specials_date_end){
                                            return $sale1->fields['sale_date_end'];
                                    }else{
                                            return $specials_date_end;
                                    }
                            }else{
                                    return $sale1->fields['sale_date_end'];
                            }
                    }else{
                            return $specials_date_end;               
                    }
    }

======================================================

2。includestemplates你的模板名templatestpl_product_info_display.php  在你想要显示的地方插入以下的代码

========================================================

    <?php
                    $end_time = zen_get_promotion_price_time((int)$_GET['products_id']). " 00:00:00";
                    $time_now = date('Y-m-d H:i:s'); //
                    $left_time = strtotime($end_time)- strtotime($time_now);
                   // echo $time_now." " . $end_time;
    ?>
           <script language="javascript" type="text/javascript">
                    var runTime = 0;
                            function CountDown(){
                                    var nMs = <?php echo $left_time ?> * 1000 - runTime * 1000;
                                    var nD = Math.floor(nMs/(1000*60*60*24));
                                    var nH = Math.floor(nMs/(1000*60*60))%24;
                                    var nM = Math.floor(nMs/(1000*60))%60;
                                    var nS = Math.floor(nMs/1000)%60
                                    if(nH<10){ nH = "0"+nH;}
                                    if(nM<10){ nM = "0"+nM;}
                                    if(nS<10){ nS = "0"+nS;}
                                    //alert(nS);
                                    //document.getElementById('productPrices').innerHTML = nH+":"+nM+":"+nS+" left";
                                    $("#productPrices #time1").html( ((nD > 0) ? nD+((nD>1)? " Days ":" Day ") :"") + nH+":"+nM+":"+nS+" left");
                                    runTime++;
                            }
                            window.onload = CountDown;
                            setInterval("CountDown()",1000);
           </script>

========================================================

3.在CSS文件中加入下面的代码:

 

====================================================

    #productPrices .off{
            background: url("../images/time.jpg") no-repeat scroll 0 0 transparent;
        color: #FFFFFF;
        float: left;
        height: 31px;
        line-height: 31px;
        padding-left: 52px;
        width: 71px;
    }
    #productPrices .productPriceDiscount {
        background: url("../images/tbg.jpg") no-repeat scroll right top transparent;
        height: 31px;
        margin-bottom: 10px;
            margin-top:5px;
        position: relative;
        width: 275px;
            font-size:12px;
    }
    #productPrices .off2 {
               color: #FFFFFF;
        display: block;
        float: left;
        height: 35px;
        line-height: 30px;
        text-align: center;
        width: 145px;
    }

====================================================

4。includestemplates你的模板名templatestpl_product_info_display.php  在你想要显示的地方插入以下的代码

 

===================================================

    <h2 id="productPrices" class="productGeneral">
    <span class="normalprice">$195.14 </span>
    <span class="productSpecialPrice">$99.00</span>
    <div id="timer_1" class="productPriceDiscount">
    <div class="off">49% off</div>
    <div id="time1" class="off2">12:46:21 left</div>
    </div>
    </h2>

===================================================

5。在includestemplates你的模板images   放入下面的两张背影图

=================这是一个分隔线=========================

 






Zen Cart常见问题的相关新闻


更早的新闻

 
 
 
外贸网站模板  |  关于我们  |  核心技术  |  人才招聘  |  帮助中心  |  zencart下载  |  付款方式  |  公司地图  |  联系我们


粤ICP备15004589号
深圳市迅捷网络技术有限公司 Copyright © 2004-2016 All Rights Reserved. 版权所有
总公司:深圳市龙华新区民治街道人民路中航天逸大厦A3栋15层     网址:www.zencart-cn.com  电话:0755-28107785
分公司:惠州市惠城区港惠新天地商业大厦2B栋19层 网址:www.0752web.com 电话:0752-2695554  2065565
全国服务热线:137 14307967   售后服务热线:159 19478387 客服QQ: 1512144 408079953 MSN:szsun@msn.com