Hi all.
Have a done a few themes myself, but in this new one, thought I'd get fancy. I have put in a jquery slider div on the left side of the screen that contains the currency changer and the search box. You know the type, little tab, you click on it and a div slides out nicely from the side of the screen with loads of goodies on it.
Only problem is, the search function has stopped working. Currency is fine.
Pressing enter after entering a search term and nothing happens. Click on the search icon and it tries to take me here:
undefinedindex.php?route=product/search&filter_name=hello
After searching the forums for a while, it does seem that there are a few problems with moving the search function. I tried a module that allows me to put the search function anywhere, but i can't put it in my custom slide-in div.
I would have thought that it might be an issue with the javascript not finding the element prorperly? But then I don't see any errors in my console.
Bit baffled. Any help appreciated. I'm on opencart 1.5.1.3
Cheers.
Have a done a few themes myself, but in this new one, thought I'd get fancy. I have put in a jquery slider div on the left side of the screen that contains the currency changer and the search box. You know the type, little tab, you click on it and a div slides out nicely from the side of the screen with loads of goodies on it.
Only problem is, the search function has stopped working. Currency is fine.
Pressing enter after entering a search term and nothing happens. Click on the search icon and it tries to take me here:
undefinedindex.php?route=product/search&filter_name=hello
After searching the forums for a while, it does seem that there are a few problems with moving the search function. I tried a module that allows me to put the search function anywhere, but i can't put it in my custom slide-in div.
I would have thought that it might be an issue with the javascript not finding the element prorperly? But then I don't see any errors in my console.
Bit baffled. Any help appreciated. I'm on opencart 1.5.1.3
Cheers.
Last edited by Tallowman on Fri Oct 21, 2011 4:47 pm, edited 1 time in total.
Unfortunately not, still in the header template, but outside the header div. I put the slide-in div straight after the body tag, before the header.
Worryingly though, when I put the Search chunk of code back where it was, it's still not working. So I removed the js that's been added, and still not working.
Gah. How does the search function work? Trying to get to the bottom of it, but can't see where it sources in the link... Will have a good look at the header controller though. Good place to start again!
Worryingly though, when I put the Search chunk of code back where it was, it's still not working. So I removed the js that's been added, and still not working.
Gah. How does the search function work? Trying to get to the bottom of it, but can't see where it sources in the link... Will have a good look at the header controller though. Good place to start again!
That's what I don't get about it breaking - I imagine that the search route is called by some js somewhere as it's not in the html, but without being familiar with the opencart js structure, there's a lot to look through!
Lin k to site - 'fraid not, it's on my xampp set up. I think I'm going to back it out and then put back in slowly, see where it breaks. If still don't get anywhere then will put live I reckon, see if anyone can make anything of it
Lin k to site - 'fraid not, it's on my xampp set up. I think I'm going to back it out and then put back in slowly, see where it breaks. If still don't get anywhere then will put live I reckon, see if anyone can make anything of it

Nearly Solved...
I forgot to echo out the base href, so that explains why it was going to the wrong place. Now it doesn't work after pressing return, only when I click on the icon. No great shakes, sure I'll figure it out.
cheers,
Tallowman
I forgot to echo out the base href, so that explains why it was going to the wrong place. Now it doesn't work after pressing return, only when I click on the icon. No great shakes, sure I'll figure it out.
cheers,
Tallowman
look in catalog/view/javascript/common.js
you should have the following or similar
If you have moved the search to a different div, try changing #header to the id of your div where it now resides.
you should have the following or similar
Code: Select all
$('#header input[name=\'filter_name\']').keydown(function(e) {
if (e.keyCode == 13) {
url = 'index.php?route=product/search';
var filter_name = $('input[name=\'filter_name\']').attr('value')
if (filter_name) {
url += '&filter_name=' + encodeURIComponent(filter_name);
}
var myString = filter_name.replace(/^\s+|\s+$/g, '');
if (myString.length > 1) {
location = url;
}
}
});
Who is online
Users browsing this forum: Majestic-12 [Bot], Semrush [Bot] and 109 guests