国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

ecshop給虛擬商品添加出售和未出售的導(dǎo)出xlc

2019-11-15 02:08:13
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
ecshop給虛擬商品添加出售和未出售的導(dǎo)出xlc

在admin/virtral_card.php文件中找到$_REQUEST['act'] == 'card'這里是用來(lái)顯示某一個(gè)虛擬商品的出售記錄的列表將會(huì)發(fā)送到replenish_list.htm在replenish_list.htm 文件中最定部分有個(gè)引入的文件叫pageheader.htm的文件這里是用于輸出默認(rèn)模版里的補(bǔ)“貨按”鈕在virtral_card.php文件大約180行有

$smarty->assign('action_link',  array('text'    => $_LANG['replenish'],                                            'href'  => 'virtual_card.php?act=replenish&goods_id='.$_REQUEST['goods_id']));

按照ecshop的習(xí)慣,需要修改語(yǔ)言包文件(語(yǔ)言包文件名和對(duì)應(yīng)的這個(gè)php文件名相同,只是在語(yǔ)言包目錄下)

$_LANG['Notforsale'] = '未出售導(dǎo)出xls';$_LANG['Hasforsale'] = '已出售導(dǎo)出xls';

在大約180行那句話下面添加如下(主要是修改一下act后的參數(shù),用于到文件中來(lái)處理數(shù)據(jù))比較重要的是forsale=has和forsale=not這兩個(gè)參數(shù),將用來(lái)區(qū)別是要導(dǎo)出已經(jīng)出售還是要導(dǎo)出未出售的

$smarty->assign('Notforsale',  array('text'    => $_LANG['Notforsale'],                                            'href'  => 'virtual_card.php?act=forsale&forsale=not&goods_id='.$_REQUEST['goods_id']));$smarty->assign('Hasforsale',  array('text'    => $_LANG['Hasforsale'],                                            'href'  => 'virtual_card.php?act=forsale&forsale=has&goods_id='.$_REQUEST['goods_id']));

具體代碼如下:

/*------------------------------------------------------ *///-- 導(dǎo)出未出售或已出售的虛擬商品到xls/*------------------------------------------------------ */elseif ($_REQUEST['act'] == 'forsale'){    $forsale = empty($_REQUEST['forsale']) ? "" : trim($_REQUEST['forsale']);    //首先判斷$forsale是否有值被傳入       if($forsale != ""){        $fielname = "";        $goods_id = empty($_REQUEST['goods_id']) ? 0 : intval($_REQUEST['goods_id']);        //has為已出售,not為未出售        if($forsale == 'has'){            $fielname = "已出售商品";            $getCurrentGoodsListsql = "SELECT card_id, goods_id, card_sn, card_passWord, end_date, is_saled, order_sn, crc32 FROM " . $GLOBALS['ecs']->table('virtual_card') . " WHERE goods_id = " . $goods_id . " and is_saled = 1" ;        }        else if($forsale == 'not'){            $fielname = "未出售商品";            $getCurrentGoodsListsql = "SELECT card_id, goods_id, card_sn, card_password, end_date, is_saled, order_sn, crc32 FROM " . $GLOBALS['ecs']->table('virtual_card') . " WHERE goods_id = " . $goods_id . " and is_saled = 0" ;        }        $currentGoodsList = $GLOBALS['db']->getAll($getCurrentGoodsListsql);        $arr = array();        foreach ($currentGoodsList AS $key => $row)        {            if ($row['crc32'] == 0 || $row['crc32'] == crc32(AUTH_KEY))            {                $row['card_sn']       = decrypt($row['card_sn']);                $row['card_password'] = decrypt($row['card_password']);            }            elseif ($row['crc32'] == crc32(OLD_AUTH_KEY))            {                $row['card_sn']       = decrypt($row['card_sn'], OLD_AUTH_KEY);                $row['card_password'] = decrypt($row['card_password'], OLD_AUTH_KEY);            }            else            {                $row['card_sn']       = '***';                $row['card_password'] = '***';            }            $row['end_date'] = $row['end_date'] == 0 ? '' : date($GLOBALS['_CFG']['date_format'], $row['end_date']);            $arr[] = $row;        }        header("Content-Type: application/vnd.ms-execl"); //定義文件的內(nèi)容類型        header("Content-Disposition: attachment; filename={$fielname}.xls");         header("PRagma: no-cache");  //不緩存        header("Expires: 0");//將內(nèi)容輸出到第一個(gè)工作簿        $data = "數(shù)據(jù)庫(kù)編號(hào)/t商品編號(hào)/t卡片序號(hào)/t卡片密碼/t截止使用日期/t是否已經(jīng)出售(1:已經(jīng)出售0:未出售)/t訂單號(hào)/t加密編碼(客戶無(wú)用,可刪除)/t/n";        foreach($arr as $key=>$val){            foreach ($val as $k => $v) {                $data .= $v . "/t";            }            $data .= "/n";        }        echo iconv("UTF-8","GB2312//IGNORE",$data);        //echo "<pre>";var_dump($data);echo "</pre>";exit();       }   }        


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 商水县| 德阳市| 贡觉县| 准格尔旗| 即墨市| 庆安县| 什邡市| 光山县| 翁牛特旗| 吉安县| 吴江市| 德令哈市| 肇州县| 玛纳斯县| 休宁县| 泽普县| 昔阳县| 封开县| 武川县| 永州市| 石柱| 兴宁市| 东安县| 衡阳县| 南乐县| 确山县| 奉新县| 蛟河市| 成安县| 河西区| 滕州市| 镇坪县| 宁明县| 满洲里市| 延寿县| 陆丰市| 兰考县| 甘洛县| 同德县| 大埔区| 龙山县|