增加檢索功能方法如下:
脩改文件:
wog_act_bid.php
找到function bid_view()
==========
找到
- 代碼: 選擇全部
global $DB_site,$_GET,$a_id,$wog_arry,$wog_item_tool;
脩改為
- 代碼: 選擇全部
global $DB_site,$_GET,$a_id,$wog_arry,$wog_item_tool,$HTTP_COOKIE_VARS;
$qKey = $_GET["qKey"];
if($qKey!="s")
{
$HTTP_COOKIE_VARS["wog_qStr"] = "";
setcookie("wog_qStr","");
}
$qStr = $_GET["qStr"];
if($qStr!="")
{
setcookie("wog_qStr",$qStr);
$qKey = "s";
}
if(!empty($HTTP_COOKIE_VARS["wog_qStr"]))
{
$qStr = $HTTP_COOKIE_VARS["wog_qStr"];
}
=========
找到
- 代碼: 選擇全部
$sale_total=$DB_site->query_first("select count(a.s_id) ... in (".$d_type.")");
改為
- 代碼: 選擇全部
$sale_total=$DB_site->query_first("select count(a.s_id) ... in (".$d_type.") and c.d_name LIKE '%$qStr%'");
===============
找到
- 代碼: 選擇全部
$sale_total=$DB_site->query_first("select count(a.pe_id) ... and a.pe_st=1");
改為
- 代碼: 選擇全部
$sale_total=$DB_site->query_first("select count(a.pe_id) ... and a.pe_st=1 and a.pe_name LIKE '%$qStr%'");
========
找到
- 代碼: 選擇全部
$sale=$DB_site->query("select b.p_name,c.d_name,c.d_at,... in (".$d_type.") ORDER BY a.s_money,a.dateline LIMIT ".$spage.",8 ");
改為
- 代碼: 選擇全部
$sale=$DB_site->query("select b.p_name,c.d_name,c.d_at,... in (".$d_type.") and c.d_name LIKE '%$qStr%' ORDER BY a.s_money,a.dateline LIMIT ".$spage.",8 ");
=======
找到
- 代碼: 選擇全部
$sale=$DB_site->query("select b.p_name,a.pe_id,a.pe_name,... and a.pe_st=1 ORDER BY a.pe_money,a.pe_s_dateline desc LIMIT ".$spage.",8 ");
改為
- 代碼: 選擇全部
$sale=$DB_site->query("select b.p_name,a.pe_id,a.pe_name,... and a.pe_st=1 and a.pe_name LIKE '%$qStr%' ORDER BY a.pe_money,a.pe_s_dateline desc LIMIT ".$spage.",8 ");
==========
找到
- 代碼: 選擇全部
showscript("parent.sale_view($sale_total[0],".$_GET["page"].",'$temp_s',".$_GET["type"].")");
改為
- 代碼: 選擇全部
showscript("parent.sale_view($sale_total[0],".$_GET["page"].",'$temp_s',".$_GET["type"].",'$qKey')");
==============================
新建文件:
./wog_sale_search.htm
內容:
- 代碼: 選擇全部
<html>
<head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=big5">
<STYLE type="text/css">
body,tr,td,th { font-size: 9pt; font-family: verdana }
</STYLE>
</head>
<body bgcolor="#000000">
<form action="wog_etc.php" method="get" name="pageform" target="mission">
<input type="hidden" name="page" value="1">
<input type="hidden" name="f" value="sale">
<input type="hidden" name="act" value="view">
<table width="97%" align="center">
<TR height="50">
<TD></TD>
<TD></TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<TD align="center"><FONT COLOR="#FFFFFF">請輸入商品名稱:</FONT> <INPUT TYPE="text" size="18" NAME="qStr"> <INPUT TYPE="submit" value="檢索"></TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<TD></TD>
<TD></TD>
</TR>
</TABLE>
</FORM>
</body>
</html>
================================
脩改文件:
wog.js
找到
- 代碼: 選擇全部
function sale_view(saletotal,page,s,type)
脩改為
- 代碼: 選擇全部
function sale_view(saletotal,page,s,type,qkey)
==============
找到
- 代碼: 選擇全部
f.write('<input type="hidden" name="act" value="view">');
在后邊追加:
- 代碼: 選擇全部
f.write('<input type="hidden" name="qKey" value="'+qkey+'"><CENTER><input type="button" value=" 檢索商品 " onclick="top.wog_view.location.replace(\'wog_sale_search.htm\');"></CENTER>');
==============
OK 商品拍賣 添加檢索功能完畢
本想將檢索功能集成到拍賣區的頁麵中,可惜存在比較痲煩的UTF8編碼問題。為暸不額外增加轉換編碼的代碼,因此使用一個新的頁麵 wog_sale_search.htm 來輸入檢索條件並用Cookies記住檢索條件,以便解決編碼問題。