Ecshop adds sold and unsold export xlc and ecshopxlc to virtual products
In the admin/virtral_card.php file, find $ _ REQUEST ['act '] = 'Card'
This shows the sale records of a virtual product will be sent to replenish_list.htm.
In the replenish_list.htm file, the most imported file named pageheader.htm is used to output the goods push button in the default template.
There are about 180 lines in the virtral_card.php File
$smarty->assign('action_link', array('text' => $_LANG['replenish'], 'href' => 'virtual_card.php?act=replenish&goods_id='.$_REQUEST['goods_id']));
According to the habit of ecshop, You need to modify the Language Pack file (the Language Pack file name is the same as the corresponding php file name, only in the Language Pack directory)
$ _ LANG ['notforsale'] = 'sold and exported xls ';
$ _ LANG ['hasforsale'] = 'sold and exported xls ';
Add the following in the sentence of about 180 rows (mainly to modify the act parameter and use it to process data in the file)
It is important that the forsale = has and forsale = not parameters are used to determine whether to export the data that has been sold or not sold.
$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']));
The Code is as follows:
/* ---------------------------------------------------- * // Export unsold or sold virtual goods to xls/* sale */elseif ($ _ REQUEST ['act '] = 'forsale ') {$ forsale = empty ($ _ REQUEST ['forsale'])? "": Trim ($ _ REQUEST ['forsale']); // first, judge whether $ forsale has a value passed in if ($ forsale! = "") {$ Fielname = ""; $ goods_id = empty ($ _ REQUEST ['goods _ id'])? 0: intval ($ _ REQUEST ['goods _ id']); // has is sold, not is not sold if ($ forsale = 'has ') {$ fielname = "sold items"; $ 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 = "goods not sold"; $ getCurrentGoodsListsql = "SELEC T 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 "); // defines the file Content type header (" Content-Disposition: attachment; filename=fielfielname=.xls "); header (" Pragma: no-cache "); // do not cache the header ("Expires: 0 "); // output the content to the first workbook $ data = "database No. \ t product no. \ tcard No. \ tcard password \ t end date \ t whether it has been sold (1: sold 0: Not sold) \ t Order Number \ t encryption code (customer useless, can be deleted) \ 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 ();}}