Hi,
We'd like the search function on our website www.liquidispose.co.uk to match partial words. We understand that this may require some Java Script. Can anyone help?
Thanks, Lucy.
Hello Lucy,
Searching for partial words is already supported if you use the asterisk character * e.g. cu* will find cup, cups etc.
If you want to make this the default behaviour when searching for terms, you will need Javascript (as you noted) to append that asterisk to the search term from the input field.
Would that be sufficient for your needs?
Well quick & dirty would be to add it to the search form element directly on its onsubmit attribute as so
onsubmit="var s=$('input[type=search]');s.val(s.val()+'*')"
That should be on both search forms - the one in sidebar and search page.
Ideally though it would be much more neatly tucked away in the theme's theme.js.liquid.
Hope this helps!
Hello, Karl! what about middle terms, e.g: The product code is R4800 and I'd like it to show on the results when I look for 800. Thanks
User | Count |
---|---|
741 | |
141 | |
101 | |
64 | |
45 |