VirtueMart Forum

VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: nflmerch on September 16, 2011, 23:13:14 pm

Title: Search doesn't support unicode
Post by: nflmerch on September 16, 2011, 23:13:14 pm
I have a new install of joomla 1.7 and the latest release of VM RC2G and that version's modules.  I installed the sample virtuemart products.

The search module removes spaces in the search string. For example, if you search for the "hand shovel" it combines the word to "handshovel" and produces no results. Same thing with the "nice saw", it changes it to "nicesaw".

I was also hoping the new virtuemart search would have the ability to search for plurals? For example, a search for "shovels" returns no results, but there are many shovels in the vm sample products.  (a search for "shovel" returns all the correct results).
Thanks
Title: Re: VM Search removes spaces
Post by: Milbo on September 18, 2011, 12:27:58 pm
ahh okey, the first thing is indeed interesting, this happens due security feature.

The other thing I must neglect, we are not gooogle :-)
Title: Re: VM Search removes spaces
Post by: nflmerch on October 07, 2011, 00:39:59 am
The search removing spaces still happens in the latest version subrelease H.
Is there something I should be doing to fix this?  Or should I just be more patient until the final release?   8)
Title: Search doesn't support unicode
Post by: constantined on October 07, 2011, 19:18:30 pm
Why in /administrator/components/com_virtuemart/models/product.php developers used JRequest::getWord?
JRequest::getString method is also safe.
Quote from: api.joomla.org
Fetches and returns a given filtered variable. The string filter deletes 'bad' HTML code, if not overridden by the mask.

upd: unicode support is need for $keyword, not for $search.
And you're right, if($search=='true') really can be deleted.
Title: Re: Search doesn't support unicode
Post by: Milbo on October 07, 2011, 21:21:34 pm
Thanks for the hint. Yepp, we must change it, also in the search.
Title: Re: Search doesn't support unicode
Post by: constantined on October 08, 2011, 06:04:48 am
But if you need better security, than provided by joomla, you can use something like
Code: [Select]
function unicodeCleaner ($str=''){
return preg_replace('/[^\w\- ]/u','',$str);
}
Title: Re: Search doesn't support unicode
Post by: Milbo on October 09, 2011, 22:45:19 pm
I changed it to getString now.
Title: Re: Search doesn't support unicode
Post by: constantined on October 10, 2011, 09:54:40 am
And one more. Why customfields search is inside search-keyword condition?
Title: Re: Search doesn't support unicode
Post by: nflmerch on October 21, 2011, 22:46:54 pm
The spaces in the search problem is close to working in subrelease J.   
Now when you have spaces in the search string, the search results are correct. 
However, it still takes out the space in the search bar, after you hit search and you're on the search results page.
Title: Re: Search doesn't support unicode
Post by: constantined on October 22, 2011, 09:48:11 am
/components/com_virtuemart/views/category/view.html.php : 102
Code: [Select]
$keyword = JRequest::getWord('keyword', '');to
Code: [Select]
$keyword = JRequest::getString('keyword', '');Note that JRequest::getString doesn't filter bad utf-8 symbols