VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: borro on September 05, 2015, 09:18:16 AM

Title: How to seek product with "(double quotes) in its names?[SOLVED]
Post by: borro on September 05, 2015, 09:18:16 AM
Hello.

At my Virtuemart 3.0.9 there is a problem to find the products having " in their names. If I'm trying to find the product called like souvenir "Big" by typing this souvenir "Big" in VM searchmodule field I shall find nothing. But if I type souvenir Big I'll see my product.

Any ideas how to fix this issue?
Title: Re: How to seek product with "(double quotes) in its names?
Post by: Studio 42 on September 05, 2015, 10:50:22 AM
Hi,
quotes get reencoded on search for security reason. I don't think you can change this without changing virtuemart core code(and this is bad)
Title: Re: How to seek product with "(double quotes) in its names?
Post by: borro on September 05, 2015, 10:58:31 AM
Quote from: Studio 42 on September 05, 2015, 10:50:22 AM
Hi,
quotes get reencoded on search for security reason. I don't think you can change this without changing virtuemart core code(and this is bad)
I'm ready to fix the core code. But I need to understand what php file my searching words are been changed in after hiting Enter.
Is it possible to enable double quotes search and keep safe Virtuemart site?
Title: Re: How to seek product with "(double quotes) in its names?
Post by: Studio 42 on September 05, 2015, 14:59:17 PM
Is this the standard VM search ?
Title: Re: How to seek product with "(double quotes) in its names?
Post by: Milbo on September 06, 2015, 12:03:43 PM
Hello borro,
I write you a pm with my skype. The problem is not trivial, but maybe already solved partly. I would like to send you the last version RC 3.0.9.8 per skype.
Title: Re: How to seek product with "(double quotes) in its names?
Post by: borro on September 08, 2015, 12:27:05 PM
Thank you, Milbo. Yes, new release works fine.

For those who cann't use a new release: if you want to find products with " in their names correspondingly typing searching words with double quotes in a built-in VM search find administrator/components/com_virtuemart/models/product.php
and replace this line(approximately line 259):
$keyword = htmlspecialchars(html_entity_decode($this->keyword, ENT_QUOTES, "UTF-8"), ENT_QUOTES, "UTF-8");
with this one:
$keyword = $db->escape( html_entity_decode($this->keyword, ENT_QUOTES, "UTF-8") );

Good luck