better admin product search

24.01.2025 14:21
#1
kreativ quadrat
User kreativ quadrat
Name: garry
25.11.2010
Сообщения: 406
Quote
better admin product search

Could you change the text search routine productsModel.php in the core admin in next version?
When I search for a product, e.g.: Zweigelt Schup, the name must be exactly "Zweigelt Schup", but I want to find the product even if Zweigelt or Schup is in the product.

change code from

if (isset($filter['text_search']) && $filter['text_search']){
$text_search = $filter['text_search'];
$word = addcslashes($db->escape($text_search), "_%");
$where .= "AND (LOWER(pr.`".$lang->get('name')."`) LIKE '%" . $word . "%' OR LOWER(pr.`".$lang->get('short_description')."`) LIKE '%" . $word . "%' OR LOWER(pr.`".$lang->get('description')."`) LIKE '%" . $word . "%' OR pr.product_ean LIKE '%" . $word . "%' OR pr.product_id LIKE '%" . $word . "%' OR pr.manufacturer_code LIKE '%" . $word . "%' OR pr.real_ean LIKE '%" . $word . "%')";
}

to

if (isset($filter['text_search']) && $filter['text_search']) {
$text_search = $filter['text_search'];
$words = explode(' ', $text_search);
$where .= "AND (";
$search_conditions = [];
foreach ($words as $word) {
$escaped_word = addcslashes($db->escape($word), "_%");
$search_conditions[] = "(LOWER(pr.`" . $lang->get('name') . "`) LIKE '%" . $escaped_word . "%'
OR LOWER(pr.`" . $lang->get('short_description') . "`) LIKE '%" . $escaped_word . "%'
OR LOWER(pr.`" . $lang->get('description') . "`) LIKE '%" . $escaped_word . "%'
OR pr.product_ean LIKE '%" . $escaped_word . "%'
OR pr.product_id LIKE '%" . $escaped_word . "%'
OR pr.manufacturer_code LIKE '%" . $escaped_word . "%'
OR pr.real_ean LIKE '%" . $escaped_word . "%')";
}
$where .= implode(" AND ", $search_conditions);
$where .= ")";
}

and also for better order search
so you find a order when you enter firstname lastname
f ($filters['text_search']){
$search = $db->escape($filters['text_search']);
$where .= " and (
O.`order_number` like '%".$search."%'
or O.`f_name` like '%".$search."%'
or O.`l_name` like '%".$search."%'
or CONCAT(O.`f_name`, ' ', O.`l_name`) like '%".$search."%'
or O.`email` like '%".$search."%'
or O.`firma_name` like '%".$search."%'
or O.`d_f_name` like '%".$search."%'
or O.`d_l_name` like '%".$search."%'
or CONCAT(O.`d_f_name`, ' ', O.`d_l_name`) like '%".$search."%'
or O.`d_firma_name` like '%".$search."%'
or O.order_add_info like '%".$search."%'
) ";
}
thx


Последнее изменение: 24.01.2025 14:32
 
26.01.2025 12:23
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 28361
Quote
Aw: better admin product search

Use github to suggest your changes
https://github.com/joomshopping/joomshopping

 
23.02.2025 18:59
#3
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 28361
Quote
Aw: better admin product search

Will be addon new option:

configuration / Other config
Admin products search by words: Y/N

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.