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

2,679 人次阅读
没有评论

共计 3334 个字符,预计需要花费 9 分钟才能阅读完成。

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

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

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

1。找到:includes\functions\functions_prices.php 插入以下代码:[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;
}
}

======================================================[/php]

2。includes\templates\你的模板名\templates\tpl_product_info_display.php  在你想要显示的地方插入以下的代码[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>

========================================================[/php]

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

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

#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;
}

====================================================[/php]

4。includes\templates\你的模板名\templates\tpl_product_info_display.php  在你想要显示的地方插入以下的代码[php]

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

<h2 id="productPrices">
<span>$195.14 </span>
<span>$99.00</span>
<div id="timer_1">
<div>49% off</div>
<div id="time1">12:46:21 left</div>
</div>
</h2>

===================================================[/php]

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

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

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

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

如有需要上面的效果,却又做不出来的,请联系我QQ(付费)

正文完
 0
评论(没有评论)