今天給大家介紹一篇文章叫修改ecshop,實(shí)現(xiàn)不間斷滾動(dòng)的發(fā)貨通知,分享給大家供大家參考。具體如下:
1、模板用的是用taobao MALL ,使用其他模板的朋友,稍改下就可以了,代碼也很簡(jiǎn)單。
2、打開(kāi)根目錄下的index.php,找到:
$smarty->assign('invoice_list', index_get_invoice_query()); // 發(fā)貨查詢
在下面添加一行:
$smarty->assign('post_list', index_get_post_query()); // 發(fā)貨通知
再找到:
/*------------------------------------------------------ */
//-- PRIVATE FUNCTIONS
/*------------------------------------------------------ */
在下面添加以下代碼:
/**
* 調(diào)用發(fā)貨公告查詢
*
* @access private
* @return array
*/
function index_get_post_query()
{
$sql = 'SELECT order_sn, user_name,action_note FROM ' . $GLOBALS['ecs']->table('order_info') . ' JOIN (' . $GLOBALS['ecs']->table('users') . ',' .
$GLOBALS['ecs']->table('order_action') . ') ON (' . $GLOBALS['ecs']->table('users') . '.user_id=' . $GLOBALS['ecs']->table('order_info') . '.user_id
AND ' . $GLOBALS['ecs']->table('order_action') . '.order_id=' . $GLOBALS['ecs']->table('order_info') . '.order_id) WHERE ' . $GLOBALS['ecs']->table
('order_info') . '.shipping_status = 1 ORDER BY shipping_time DESC LIMIT 10';
$postinfo = $GLOBALS['db']->getAll($sql);
clearstatcache();
return $postinfo;
}
3、在使用模板里面的library目錄里,新建一個(gè)post_list.lbi的文件,把以下代碼復(fù)制到這個(gè)文件里面去!
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<DIV id=demo style="overflow:hidden;height :220px;width :200px;">
<DIV id=demo1>
<!-- 發(fā)貨公告{foreach from=$post_list item=post} -->
<font color=red>{$post.user_name}</font> 您好,您所購(gòu)物品將于 <font color=red>{$post.action_note}
</font> 發(fā)出,我們預(yù)先短信通知您,請(qǐng)注意查收!<br>---------------------------------<br>
<!-- 發(fā)貨公告{/foreach}-->
</DIV>
<DIV id=demo2>
</DIV>
</DIV>
</DIV>
<SCRIPT>
var speed=100
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight
else{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function(){clearInterval(MyMar)}
demo.onmouseout=function(){MyMar=setInterval(Marquee,speed)}
</SCRIPT>
4、然后打開(kāi)index.dwt,找到:
<div class="NewsList tc">
把下面的那段代碼改為:
<!-- #BeginLibraryItem "/library/post_list.lbi" --><!-- #EndLibraryItem -->
這樣就行了,其他的模板根據(jù)自己喜歡,把上面那段代碼放到你想要的地方去!
新聞熱點(diǎn)
疑難解答
圖片精選