Hello.
The default behavior of cs-cart is when you leave the search form empty then all the products are listed in result. But I need to check the input string and if it is empty either output nothing or give a notification “Hey, you need enter some symbols”. I can't find the php file where the storefront search input is being checked.
Dear Breezee,
- Open [color=#262626][font=arial, sans-serif][size=3]app\controllers\frontend\products.php file. [/size][/font][/color]
[color=#262626][font=arial, sans-serif][size=3]2. After the code [/size][/font][/color]
[color=#262626][font=arial, sans-serif][size=3]
[/size][/font][/color]
use Tygh\Registry;
use Tygh\BlockManager\ProductTabs;[/size][/font][/color]
[color=#262626][font=arial, sans-serif][size=3]if (!defined('BOOTSTRAP')) { die('Access denied'); }[/size][/font][/color]
[color=#262626][font=arial, sans-serif][size=3]//
// Search products
//
if ($mode == 'search') {[/size][/font][/color]
[color=#262626][font=arial, sans-serif][size=3] $params = $_REQUEST;[/size][/font][/color]
[color=#262626][font=arial, sans-serif][size=3] if (!empty($params['search_performed']) || !empty($params['features_hash'])) {[/size][/font][/color]
[color=#262626][font=arial, sans-serif][size=3] fn_add_breadcrumb(__('advanced_search'), "products.search" . (!empty($_REQUEST['advanced_filter']) ? '?advanced_filter=Y' : ''));
fn_add_breadcrumb(__('search_results'));
$params = $_REQUEST;[/size][/font][/color]
[color=#262626][font=arial, sans-serif][size=3]
Add the following lines
if (!empty($params['q'])) {
$check_q = trim($params['q']);
}
if (empty($check_q) OR empty($params['q'])) {
fn_set_notification('N', __('notice'), 'Hey, you need enter some symbols');
return array(CONTROLLER_STATUS_REDIRECT, '');
}
The empty page will be opened if there is an empty input.
This code is suitable for 3 and 4 versions.
Best regards, Alt-team.
Works great!
Thank you Alt-team
[quote name='breezee' timestamp='1417172403' post='198243']
Hello.
The default behavior of cs-cart is when you leave the search form empty then all the products are listed in result. But I need to check the input string and if it is empty either output nothing or give a notification “Hey, you need enter some symbols”. I can't find the php file where the storefront search input is being checked.
[/quote]
You can download our free Search Improvements module
Модуль "Улучшение Поиска" для CS-Cart и Multi-Vendor
Minimum amount of characters can be configured. Also it has another useful features.
[quote name='eComLabs' timestamp='1417186794' post='198270']
You can download our free Search Improvements module
http://www.ecom-labs…nts-add-on.html
Minimum amount of characters can be configured. Also it has another useful features.
[/quote]
Thank you very much!
Nice plugin, I will absolutely try it.
[quote name='breezee' timestamp='1417183335' post='198267']
Works great!
Thank you Alt-team
[/quote]
We are glad that you like our solution.
If you have any problems with Cs-Cart, do not hesitate to contact us.
Best regards, Alt-team.