Reduce minimum search size Topic is solved
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Reduce minimum search size
Hello all
I know this is a weird one , but currently the default search module needs a minimum of 3 letters. Our site is a car club and a lot of the car models are 2 letters.
Is there a way to reduce this minimum to 2?
I have tried Smart Search and that doesn't really work for us
Thanks
Terry
I know this is a weird one , but currently the default search module needs a minimum of 3 letters. Our site is a car club and a lot of the car models are 2 letters.
Is there a way to reduce this minimum to 2?
I have tried Smart Search and that doesn't really work for us
Thanks
Terry
-
- Joomla! Hero
- Posts: 2863
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: Reduce minimum search size
It's defined in language pack but can be overridden with a system plugin.
https://docs.joomla.org/J3.x:Creating_a ... for_Joomla
Code: Select all
defined('_JEXEC') or die;
use Joomla\CMS\Plugin\CMSPlugin;
class PlgSystemExample extends CMSPlugin
{
protected $app;
public function onAfterInitialise()
{
$this->app->getLanguage()->setLowerLimitSearchWordCallback(array($this, 'setLowerLimitSearchWord'));
}
public static function setLowerLimitSearchWord()
{
return 2;
}
}
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Re: Reduce minimum search size
I am really sorry but I am completely lost.
Can I overide the language pack?
Thanks
Terry
Can I overide the language pack?
Thanks
Terry
-
- Joomla! Hero
- Posts: 2863
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: Reduce minimum search size
If you edit language pack files, your changes will be lost when updating Joomla! (if you use en-GB language) or when updating language pack (if you use any other language).
Plugin method doesn't have this issue.
Plugin method doesn't have this issue.
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Re: Reduce minimum search size
Thanks, will try and figure it out
Cheers
Terry
Cheers
Terry
- leolam
- Joomla! Master
- Posts: 20651
- Joined: Mon Aug 29, 2005 10:17 am
- Location: Netherlands/ Germany/ S'pore/Bogor/ North America
- Contact:
Re: Reduce minimum search size
Sorry but that is only partly correct. Language overrides are a basic functionality with languages and they are not replaced with an update
Leo
Joomla's #1 Professional Services Provider:
#Joomla Professional Support: https://gws-desk.com -
#Joomla Specialized Hosting Solutions: https://gws-host.com -
#Joomla Professional Support: https://gws-desk.com -
#Joomla Specialized Hosting Solutions: https://gws-host.com -
-
- Joomla! Hero
- Posts: 2863
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: Reduce minimum search size
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Re: Reduce minimum search size
I am really sorry but I cannot figure out how to create a system plugin?
Could I do it by copying a file in Cpanel file manager then renaming and changing the content to as above?
Sorry to be a bit of a numpty!
Thanks
Terry
Could I do it by copying a file in Cpanel file manager then renaming and changing the content to as above?
Sorry to be a bit of a numpty!
Thanks
Terry
-
- Joomla! Guru
- Posts: 561
- Joined: Thu Jan 12, 2017 10:13 am
Re: Reduce minimum search size
This tutorial could give you a total vision of how to create a plugin in joomla:
https://docs.joomla.org/J3.x:Creating_a ... for_Joomla
Kian William
https://docs.joomla.org/J3.x:Creating_a ... for_Joomla
Kian William
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Re: Reduce minimum search size
Thanks I must be thick , I made the plugin in the three parts, zipped and installed. It seems to install correctly. When I enabled in plugins, it put some text from the code at the top of the page????
I have now disabled it again.
Any ideas
Thanks
I have now disabled it again.
Any ideas
Thanks
Last edited by tezzerp on Tue Jan 15, 2019 10:07 am, edited 1 time in total.
- toivo
- Joomla! Master
- Posts: 17350
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: Reduce minimum search size
Add a line starting with the characters <?php to the beginning of the PHP file.
Compress a zip folder containing the PHP file with the code, posted by @SharkyKZ, and the XML file, the manifest file that you need to create.
Compress a zip folder containing the PHP file with the code, posted by @SharkyKZ, and the XML file, the manifest file that you need to create.
Toivo Talikka, Global Moderator
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Re: Reduce minimum search size
Thanks, now done that and it installed and looks OK, no funny text
But It doesn't work :-(
Is the code above correct?
Thanks
Terry
But It doesn't work :-(
Is the code above correct?
Thanks
Terry
- toivo
- Joomla! Master
- Posts: 17350
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Re: Reduce minimum search size
Yes, managed to figure it out. I cobbled together the manifest file and didn't realise the difference between content and system. Now installed and working :-)
One question , how do I delete the old version?
Thanks
Terry
One question , how do I delete the old version?
Thanks
Terry
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Re: Reduce minimum search size
Sorted, deleted it now.
Thanks to everyone for your help. I have now created my own plugin
Now to market it ......... :-)
Terry
Thanks to everyone for your help. I have now created my own plugin
Now to market it ......... :-)
Terry
- toivo
- Joomla! Master
- Posts: 17350
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: Reduce minimum search size
Good to hear. The plugin created by @SharkyKZ is simple but effective.
You could add an option to your plugin to let the administrator select the minimum length of the search word.
You could add an option to your plugin to let the administrator select the minimum length of the search word.
Toivo Talikka, Global Moderator
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Mon Aug 20, 2018 1:48 pm
Re: Reduce minimum search size
OK how would I do that? :-)
Thanks
Terry
Thanks
Terry
-
- Joomla! Guru
- Posts: 561
- Joined: Thu Jan 12, 2017 10:13 am
Re: Reduce minimum search size
In manifest file(plugin .xml)file, under <config> and <fields name='params'> tags consider a jformfield of text type with name, .... and then employ it in plugin php file, study the tutorial, it is not difficult.
Kian William
Kian William