Find $_request[' act ' = = ' card ' in the admin/virtral_card.php file
Here is a list of the sales records used to display a virtual item that will be sent to replenish_list.htm
In the replenish_list.htm file, the most certain part of the file is the introduction of a file called pageheader.htm, which is used to output the default template in the "Press" button
In the virtral_card.php file approximately 180 lines have
$smarty->assign (' Action_link ', array(' text ' $_lang[' replenish '], ' href ' = ' virtual_card.php?act=replenish&goods_id= '. $_request[' goods_id ']);
According to Ecshop's custom, the language pack file needs to be modified (the language pack filename and the corresponding PHP file name are the same, just under the Language pack directory)
$_lang[' notforsale ' = ' not sold ' export xls ';
$_lang[' hasforsale ' = ' sold export xls ';
In about 180 lines the following is added below (mainly to modify the parameters after the Act, for the file to process the data)
It is important that the two parameters, Forsale=has and Forsale=not, will be used to distinguish whether the export has been sold or is to be exported
$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 specific code is as follows:
/*------------------------------------------------------ *///--export unsold or sold virtual goods to XLS/*------------------------------------------------------ */ElseIf($_request[' act '] = = ' Forsale '){ $forsale=Empty($_request[' Forsale ']) ? "" :Trim($_request[' Forsale ']); //first determine if the $forsale has a value being passed in if($forsale!= ""){ $fielname= ""; $goods _id=Empty($_request[' goods_id ']) ? 0:intval($_request[' goods_id ']); //has for sold, not for unsold if($forsale= = ' has '){ $fielname= "Sold Goods"; $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= "Unsold goods"; $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");//define the content type of the file Header("Content-disposition:attachment; filename={$fielname}.xls "); Header("Pragma:no-cache");//do not cache Header("expires:0");//output content to the first workbook $data= "Database number \ t product number \ t card number \ t card password \ t cutoff date \ t 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 ""; Var_dump ($data); echo"
"; exit (); } }
The above describes the Ecshop to the virtual goods to add the sale and not sell the export xlc, including the content, I hope that the PHP tutorial interested in a friend helpful.