广州传奇网络

地址:广州市天河区东圃大马路富华楼C座

电话:13808825895

邮箱:gz020wbs@163.com

QQ:1564443073

网址:http://www.020wbs.com/

首页 > 二次开发Ecshop二次开发 > 后台添加搜索功能讲解

二次开发Ecshop二次开发

二次开发Ecshop二次开发

后台添加搜索功能讲解

目前后台按照我们自身的需求便于管理可能要加搜索功能,比如供货商列表,如果信息太多的话加个搜索会更方便些,当然如果有基础的网友不用看此贴直接模仿官方有搜索模块的就成,没基础的网友按照我写的思想而且能依次应用到其他模块里,有时间我也会根据此录制视频细细讲解。
第一步 打开suppliers_list.htm 在顶部<form>上面加入
{include file="suppliers_search.htm"}
然后你需要新建一个suppliers_search.htm页面放入后台模板文件夹下
<div class="form-div">
<form action="javascript:search_suppliers()" name="searchForm">
<img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />

{$lang.keyword} <input type="text" name="suppliers_name" size="15" />
<input type="submit" value="{$lang.button_search}" class="button" />
</form>
</div>

<script language="JavaScript">
function search_suppliers()
{
listTable.filter['suppliers_name'] = Utils.trim(document.forms['searchForm'].elements['suppliers_name'].value);

listTable.filter['page'] = 1;
listTable.loadList();
}
</script>
第二步 打开 suppliers.php 513行左右加入
$filter['suppliers_name'] = $_REQUEST['suppliers_name'];
if($filter['suppliers_name'])
{

$suppliers_name = $filter['suppliers_name'];
$where .= " and suppliers_name like '%$suppliers_name%'";
}