繁体   English   中英

PHP注意:未定义的索引:filter_name-Opencart 1.5.6.1

[英]PHP Notice: Undefined index: filter_name - Opencart 1.5.6.1

希望你能在这里帮助我。 我正在运行opencart 1.5.4,并且必须使用新的托管帐户将版本升级到1.5.6.1。 从那时起,我的搜索无法通过标题搜索框进行。

我一直在使用vqmod,它修改了搜索以包括AND而不是OR,因此它在1.5.4的早期版本中返回诸如“ hp p1105”(我的网站是打印机墨盒的网站)之类的结果。 由于升级到1.5.6.1,标头搜索不会返回任何结果。

举个例子; 如果通过转到新的托管帐户链接搜索“ hp p1005”,它将不会显示任何结果并返回http://64.34.75.145/~sydne716/index.php?route=product/search&search=hp%20p1005

但是,如果我修改了相同的返回链接以包含filter_name,那么它将按预期显示结果。 http://64.34.75.145/~sydne716/index.php?route=product/search&filter_name=hp%20p1005

另外,如果我再次在搜索结果页面中搜索,它将返回所有搜索项。

我尝试在opencart论坛上发帖,得到的回复很少,但是似乎没有任何帮助解决我遇到的问题。 Opencart论坛链接

我也在系统中出现以下错误->错误部分

2015-09-13 20:22:20-PHP注意:未定义的索引:在第481行的/home/sydne716/public_html/vqmod/vqcache/vq2-catalog_model_catalog_product.php中的filter_name

如果有人可以在这里提供帮助,我将不胜感激。 我正在等待使用新的托管帐户,但是如果没有搜索工作,我将无法继续。

谢谢,感谢您的帮助。

catalog/view/javascript/common.js更改:

$('.button-search').bind('click', function() {
    url = $('base').attr('href') + 'index.php?route=product/search';

    var search = $('input[name=\'search\']').attr('value');

    if (search) {
        url += '&search=' + encodeURIComponent(search);
    }

    location = url;
});

至:

$('.button-search').bind('click', function() {
    url = $('base').attr('href') + 'index.php?route=product/search';

    var search = $('input[name=\'search\']').attr('value');

    if (search) {
        // NOTE: search was changed to filter_name
        url += '&filter_name=' + encodeURIComponent(search);
    }

    location = url;
});

$('#header input[name=\\'search\\']').bind('keydown', function(e) {

删除<base>标记后,我遇到同样的问题。 要修复,请编辑catalog/view/javascript/common.js 更换:

$('base').attr('href')

与:

location.protocol + "//" + location.host + '/'

另一个使用.htaccess修复它的方法:

# === fix router error ===
RewriteCond %{QUERY_STRING}  ^(.*)_route_=undefined[^&]*&(.*)$ [NC]
RewriteRule .* %{REQUEST_URI}?%1%2 [R,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM