Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Admin filter not working
#1
Hi,

Testing version 1.11.0 and found out that the filter is not working in administration for Categories and Products. It seems that returns No Results. I also tested on the demo admin page and still returns No Results.

(Later update...)

I just notice this:
Try to search in demo admin site products with Name: ipod. The returning search page URL is: 'http://demo.villagedefrance.net/admin/index.php?route=catalog/product&token=33e9c0112bb8aa27a5f05504eb453096&filter_status=undefined'
And No Results message appears on the list.

I manually changed the URL with that: 'http://demo.villagedefrance.net/admin/index.php?route=catalog/product&token=33e9c0112bb8aa27a5f05504eb453096&filter_name=ipod'
And BINGO! the ipod products appears on the list.
So something on the code returns filter_status as 'undefined'. Can be checked why is this happening?
Reply
#2
I think i found what causing the problem. The solution is not 100% tested but it seems that is working. Please test it and let me know if is ok.
In the file "admin\view\template\catalog\product_list.tpl" find the javascript function "filter()" - it must be around line 180. Replace in each input variable ".attr('value')" to ".val()". This one is solving the issue.

The final code is:

function filter() {
url = 'index.php?route=catalog/product&token=<?php echo $token; ?>';

var filter_name = $('input[name=\'filter_name\']').val();

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

var filter_model = $('input[name=\'filter_model\']').val();

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

var filter_price = $('input[name=\'filter_price\']').val();

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

var filter_quantity = $('input[name=\'filter_quantity\']').val();

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

var filter_status = $('select[name=\'filter_status\']').val();

if (filter_status != '*') {
url += '&filter_status=' + encodeURIComponent(filter_status);
}

location = url;
}
Reply
#3
Yes, your solution works. Nice one.

I have however already changed all the filters using ".prop('value')" which also works.
35 admin pages have now been corrected on Github.


Feel free to download the Github repo for testing.

Your feedback is much appreciated.
OpenCart Overclocked Edition Lead developer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)