Extension marketplace search/filter is broken
What version of OpenCart are you reporting this for? 4.0.2.3
Describe the bug Extension marketplace search does not work at all, nothing happens when you attempt to search and in developer tools console this JavaScript error shows up:
index.php?route=marketplace/marketplace&user_token=3c64ad376aae98b843c5d98ae2270260&filter_license=free:820 Uncaught ReferenceError: download is not defined
at HTMLButtonElement.
To Reproduce Steps to reproduce the behavior: in the Admin panel goto Extensions -> Marketplace and attempt to search/filter the results
Expected behavior Search results refined by the filter.
Server / Test environment (please complete the following information):
- FreeBSD 14.2-RELEASE-p1
- PHP 8.2
- Apache version 2.4.63
- Microsoft Edge, Chrome, Safari, Firefox
Can confirm behaviour in version 4.1.0.3
Know this is not about another opencart version, but Daniel, can you look at this issue:
searching on official opencart.com marketplace:
Searching keyword: "xml import pro" https://www.opencart.com/index.php?route=marketplace/extension&filter_search=xml%20import%20pro
Exact extension is on 3th page: https://www.opencart.com/index.php?route=marketplace/extension&filter_search=xml%20import%20pro&page=3
Can you please look at that? Thanks
admin\view\template\marketplace\marketplace_list.twig
Find:
<script type="text/javascript"><!--
$('#button-filter').on('click', function(e) {
var url = 'index.php?route=marketplace/marketplace&user_token={{ user_token }}';
var input = $('#extension-filter :input');
for (i = 0; i < input.length; i++) {
if ($(input[i]).val() !== '') {
url += '&' + $(input[i]).attr('name') + '=' + $(input[i]).val()
}
}
download();
location = url;
});
$('#input-search').keydown(function(e) {
if (e.keyCode == 13) {
e.preventDefault();
$('#button-filter').trigger('click');
}
});
//--></script>
Replace with:
<script type="text/javascript"><!--
$('#button-filter').on('click', function(e) {
var url = 'index.php?route=marketplace/marketplace&user_token={{ user_token }}';
var input = $('#extension-filter :input');
for (i = 0; i < input.length; i++) {
if ($(input[i]).val() !== '') {
url += '&' + $(input[i]).attr('name') + '=' + $(input[i]).val()
}
}
location = url;
});
$('#input-search').keydown(function(e) {
if (e.keyCode == 13) {
e.preventDefault();
$('#button-filter').trigger('click');
}
});
//--></script>
TLDR; Remove the un-used call to download(), not sure why that's there
Nice simple fix @exelaguilar, thanks. It looks like Master branch version has completely rewritten this module.
I'm getting this too (4.0.2.3), removing download(); does get rid of the error in dev console when loading the page, but doesn't get rid of the core issue of the extension marketplace not working (No results! no matter what filters I have on). Might be related but I also can't see anything in the Latest Version, Release Date or Change Log boxes under Maintenance -> upgrade. There's nothing in logs, the only error I could find is the above download() error but I don't think that's related.