News:

Support the VirtueMart project and become a member

Main Menu

Search not work

Started by alexboot, February 24, 2012, 10:26:12 AM

Previous topic - Next topic

alexboot

Help
After input search string like :  absd-tg  the special ASCII characters "-" (aslo '.' '/' ) is ignored Why?
As a result search comes to the end with crash

osp

Which version?
Mine 201N + PHP5.3 works, dashes are ignored in a search...

alexboot


alexboot

Vm 2.0.1.N
PHP 5.3.10
Joomla 1.7.3


All the same does not work

jjk

I can reproduce that with a similar search. One of the devlopers is looking after that problem
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Sergi0

Hello!
I Have same trouble on 2.0.2 Virtuemart:
I tried to search 165/55r15, but virtuemart use _db->getEscaped to filter any extra characters and after that i have search string 16555r15.

ssustar52

Quote from: Sergi0 on February 25, 2012, 10:18:49 AM
Hello!
I Have same trouble on 2.0.2 Virtuemart:
I tried to search 165/55r15, but virtuemart use _db->getEscaped to filter any extra characters and after that i have search string 16555r15.


it's not the _db->getEscaped but the use of vmRequest::uword

this function can be edited in /administrator/components/com_virtuemart/helpers/config.php

you can change the regex used.  BUT be EXTREMELY careful!  You could open up security holes by changing this regex.

RobertL

#7
There's a 2 3 part solution for this so far biggest blunder in my opinion in VM2

For Frontend
1. edit plugins/search/virtuemart.php to enable search by SKU

Line 137
$query = "SELECT DISTINCT CONCAT( a.product_name,' (',p.product_sku,')' ) AS title, a.virtuemart_product_id , b.virtuemart_category_id ,   a.product_s_desc   AS text, b.category_name as section,

Change to:
$query = "SELECT DISTINCT CONCAT( a.product_name,' (',p.product_sku,')' ) AS title, a.product_name , p.product_sku , a.virtuemart_product_id , b.virtuemart_category_id ,   a.product_s_desc   AS text, b.category_name as section,

2. edit administrator/components/com_virtuemart/helpers/config.php to allow search by "-" character. This is from rippergr http://forum.virtuemart.net/index.php?topic=101774.0

Line 887
return mb_ereg_replace('[^\w'.preg_quote($custom).']', '', $source);

Change to:
return mb_ereg_replace('/[^\w'.preg_quote($custom).']/', '', $source);

3. finally, edit language/en-GB/en-GB.com_virtuemart.ini since message is not defined for COM_VIRTUEMART_SEARCH_RESULTS just add following line anywhere (or in order, no matter). You can edit the message to whatever you want
COM_VIRTUEMART_SEARCH_RESULTS="Search results for"

tampasounds

Thanks Robert works good.

patrik60

Quote1. edit plugins/search/virtuemart.php to enable search by SKU

Sorry, but this makes absolutely no sense. This is the search plugin for Joomla search and has no influence in the search function of the VM search module. You may either disable or even delete this file. VM search module is still working but will never find products by SKU.

And btw: the search plugin will find products by SKU without this patch.

But anyway thank you for the second tip (2. edit administrator/components/com_virtuemart/helpers/config.php to allow search by "-" character.) This works fine for me!! I hope I won't get in security troubles ;-)