- Posts: 55
- Thank you received: 0
Text filter only on the whole word
- gioferrario@gmail.com
-
Topic Author
- Offline
Less
More
11 years 9 months ago #189396
by gioferrario@gmail.com
Text filter only on the whole word was created by gioferrario@gmail.com
-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.35
-- Browser(s) name and version -- : crome
Good morning, I'm configuring a filter textual hikashop bussines and I have to look for numbers in a custom field, my problem is that if the number in question has three digits is the right product, but if the number has only its digits is all products with three digits appear where those two.
An example: my products have a characteristic number, as I have three products, one is called the 789 one is called 89 and the other is called 123, and all belong to the same category, if I put in the text field 789 no problem, appears only the 789 but if I try the 89 shows both the 89 and 789 that I want to appear only 89. Among the selection items that attach not found anything that responds to the event.
Thank You
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.35
-- Browser(s) name and version -- : crome
Good morning, I'm configuring a filter textual hikashop bussines and I have to look for numbers in a custom field, my problem is that if the number in question has three digits is the right product, but if the number has only its digits is all products with three digits appear where those two.
An example: my products have a characteristic number, as I have three products, one is called the 789 one is called 89 and the other is called 123, and all belong to the same category, if I put in the text field 789 no problem, appears only the 789 but if I try the 89 shows both the 89 and 789 that I want to appear only 89. Among the selection items that attach not found anything that responds to the event.
Thank You
Please Log in or Create an account to join the conversation.
11 years 9 months ago #189412
by nicolas
Replied by nicolas on topic Text filter only on the whole word
Hi,
That's how the system is made.
If you want to change that, you need to edit the file administrator/components/com_hikashop/classes/filter.php and remove all the % characters in the code:
Then, the filter will only match exact values.
That's how the system is made.
If you want to change that, you need to edit the file administrator/components/com_hikashop/classes/filter.php and remove all the % characters in the code:
Code:
if(@$searchProcessing != 'any'){
foreach($terms as $term){
if(empty($term)) continue;
$array =array();
foreach($searchField as $column){
$array[]=' b.'.$column.' LIKE \'%'.hikashop_getEscaped($term, true).'%\' ';
$fields[] = ' reference_field = \''.$column.'\' ';
}
$list[]='('.implode(' OR ', $array).')';
$translationList[] = 'value LIKE \'%'.hikashop_getEscaped($term, true).'%\'';
}
$filters[]='('.implode(' AND ', $list).')';
$translationFilters = '('.implode(' AND ', $translationList).')';
}else{
foreach($terms as $term){
if(empty($term))
continue;
foreach($searchField as $column){
$list[]=' b.'.$column.' LIKE \'%'.hikashop_getEscaped($term, true).'%\' ';
$fields[] = ' reference_field = \''.$column.'\' ';
}
$translationList[] = 'value LIKE \'%'.hikashop_getEscaped($term, true).'%\'';
}
$filters[]='('.implode(' OR ', $list).')';
$translationFilters = '('.implode(' OR ', $translationList).')';
}
The following user(s) said Thank You: gioferrario@gmail.com
Please Log in or Create an account to join the conversation.
- gioferrario@gmail.com
-
Topic Author
- Offline
Less
More
- Posts: 55
- Thank you received: 0
11 years 9 months ago #189540
by gioferrario@gmail.com
Replied by gioferrario@gmail.com on topic Text filter only on the whole word
Wow perfect !! think that in future editions it was inserted as an option with choices from buttons?
Thank you very much
Thank you very much
Please Log in or Create an account to join the conversation.
11 years 9 months ago #189557
by nicolas
Replied by nicolas on topic Text filter only on the whole word
Hi,
Yes, we'll add an "exact" choice for the "search processing" option of the text filters in the next version in order to avoid the need for a code modification.
Yes, we'll add an "exact" choice for the "search processing" option of the text filters in the next version in order to avoid the need for a code modification.
Please Log in or Create an account to join the conversation.
Time to create page: 0.045 seconds