首页建站经验 ecshop搜索出现相关商品的效果滑动下拉效果

ecshop搜索出现相关商品的效果滑动下拉效果

ecshop搜索栏效果如下所需要的样式我们可以复制到style.css里:/*搜索滑动效果*/.Menu {position:absolute;top:30px;left:7px;width:150px;height:auto;z-index:1;background…

ecshop搜索栏效果如下

ecshop搜索出现相关商品的效果滑动下拉效果

所需要的样式我们可以复制到style.css里:

/*搜索滑动效果*/

.Menu {

position:absolute;

top:30px;

left:7px;

width:150px;

height:auto;

z-index:1;

background:#FFF;

border:1px solid #000;

display:none;

}

.Menu2 {

position: absolute;

left:0;

top:0;

width:100%;

height:auto;

overflow:hidden;

z-index:1;

}

.Menu2 ul{margin:0;padding:0}

.Menu2 ul li{width:100%;height:25px;line-height:25px;text-indent:15px;

border-bottom:1px dashed #ccc;color:#666;cursor:pointer;background:#FFF;

change:expression(

this.onmouseover=function(){

this.style.background="#F2F5EF";

},

this.onmouseout=function(){

this.style.background="";

}

)

}

input{width:200px}

.form{width:200px;height:auto;}

.form p{position:relative;top:0;left:0;margin-bottom:5px}

以下代码需要加到输入框普遍 比如page_header.lbi

我们输入框的代码

ajax请求php的代码

search_p.php

<?php

define('IN_ECS', true);

require(dirname(__FILE__) . '/includes/init.php');

require(dirname(__FILE__) . '/admin/includes/lib_main.php');

if($_REQUEST['act'] == 'search'){

$keywords = json_str_iconv(trim($_GET['text']));

$sql = "SELECT goods_name,goods_id FROM " . $GLOBALS['ecs']->table('goods')." where goods_name like '%$keywords%'";

$brand_array = $GLOBALS['db']->getall($sql);

foreach($brand_array as $ids =>$value)

{

$brand_array[$ids]['goods_name'] = sub_str_xaphp($brand_array[$ids]['goods_name'],5);

}

make_json_result($brand_array);

}

function sub_str_xaphp($str, $length = 0, $append = true)

{

$str = trim($str);

$strlength = strlen($str);

if ($length == 0 || $length >= $strlength)

{

return $str;

}

elseif ($length < 0)

{

$length = $strlength + $length;

if ($length < 0)

{

$length = $strlength;

}


}

if (function_exists('mb_substr'))

{

$newstr = mb_substr($str, 0, $length, EC_CHARSET);

}

elseif (function_exists('iconv_substr'))

{

$newstr = iconv_substr($str, 0, $length, EC_CHARSET);

}

else

{

//$newstr = trim_right(substr($str, 0, $length));

$newstr = substr($str, 0, $length);

}

if ($append && $str != $newstr)

{

$newstr .= '';

}

return $newstr;

}

?>

在商品少的情况下 我们之间查询 如果多了,建议修改程序

本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/jianzhan/jingyan/18385.html
上一篇如何批量清除ECShop管理员日志
下一篇 让ecshop支持自定义分类模板子类可以继承的方法
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们

    关注微博
    返回顶部