Author Topic: Search not work  (Read 3752 times)

alexboot

  • Beginner
  • *
  • Posts: 7
Search not work
« on: February 24, 2012, 10:26:12 am »
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

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 66
Re: Searh not work
« Reply #1 on: February 24, 2012, 14:08:28 pm »
Which version?
Mine 201N + PHP5.3 works, dashes are ignored in a search...

alexboot

  • Beginner
  • *
  • Posts: 7
Re: Search not work
« Reply #2 on: February 24, 2012, 14:27:06 pm »
Now I will check up

alexboot

  • Beginner
  • *
  • Posts: 7
Re: Search not work
« Reply #3 on: February 24, 2012, 14:52:20 pm »
Vm 2.0.1.N
PHP 5.3.10
Joomla 1.7.3


All the same does not work

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3423
  • using Matomo instead of Google Analytics
Re: Search not work
« Reply #4 on: February 24, 2012, 19:45:42 pm »
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

  • Beginner
  • *
  • Posts: 2
Re: Search not work
« Reply #5 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.

ssustar52

  • Beginner
  • *
  • Posts: 8
Re: Search not work
« Reply #6 on: April 02, 2012, 21:49:56 pm »
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

  • Beginner
  • *
  • Posts: 44
Re: Search not work
« Reply #7 on: July 15, 2012, 13:50:20 pm »
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
Code: [Select]
$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:
Code: [Select]
$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
Code: [Select]
return mb_ereg_replace('[^\w'.preg_quote($custom).']', '', $source);
Change to:
Code: [Select]
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
Code: [Select]
COM_VIRTUEMART_SEARCH_RESULTS="Search results for"

tampasounds

  • Beginner
  • *
  • Posts: 12
Re: Search not work
« Reply #8 on: October 15, 2012, 19:43:04 pm »
Thanks Robert works good.

patrik60

  • Guest
Re: Search not work
« Reply #9 on: October 16, 2012, 15:20:59 pm »
Quote
1. 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 ;-)