News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

VM 2.6.0 - SEARCH : Apostrophe " ' " output " 39 "

Started by faman, April 24, 2014, 15:31:39 PM

Previous topic - Next topic

faman

After update to VM 2.6.0, when i make a search using the VM search module, the apostrophe is replaced at output by " 39 " so it cannot find the product.

eg: "l'imitation" => l39imitation but before "l'imitation" => limitation

Tested on Beez5 give the same result.

In the other hand, is there a way, when alias is created to force apostrophe to be replaced by nothing, now it is replaced by " - "

eg: DARBOY - L'imitation de Jésus-Christ => darboy-l-imitation-de-jesus-christ but darboy-limitation-de-jesus-christ

thanks for the help.

emuleb

We have the same problem, when we want to search a product SKU with dashes in it, it returns with a faulty message and the dashes are gone ("-")

hegbi

Same here, no matter which search module I am using, when I search apostrophe, No results: (39)

hegbi

for me, this works, search
$keyword =  '"%' .str_replace(array(' ','-'),'%',$this->_db->getEscaped( $this->keyword, true )). '%"';

around line 266 in administrator/components/com_virtuemart/models/product.php
and add '#39' like this

$keyword =  '"%' .str_replace(array(' ','-','#39'),'%',$this->_db->getEscaped( $this->keyword, true )). '%"';

rbongartz

In response to Hegbi, Thank you for the quick fix!

It is not totally fixed however. When I type in "Kitten's" the search term on the search results screen displays as "Kitten39s".

Thankfully it will still load the relevant "Kitten's" product, but it is definitely confusing for my customers not to mention unprofessional looking.

Has anyone figured out the true cause of the issue?

It worked just fine before upgrading to VirtueMart 2.6.6

hegbi

thx rbongartz, do you remember what was your previous version of VM2?

hegbi

you can try this as a temp solution...
the easiest way is to replace 39 with ', but we have to be careful to replace only apostrophes, not real 39 numbers like in EAN or SKU numbers, so:

pls check first if you have this file
/templates/"yourtemplatename"/html/com_virtuemart/category/default.php
if not, pls copy it from components/com_virtuemart/views/category/tmpl/default.php to avoid overwrite from updates and then edit
around line 150+ find
<h3><?php echo JText::_('COM_VIRTUEMART_SEARCH_RESULTS') . ( $this->keyword ? ': ' . $this->keyword : '' ); ?></h3>

and replace with these two lines

<h3><?php ($this->keyword = vRequest::uword ('keyword', "", ' ,#39,-,+,.,_,#,/')); ?></h3>
<h3><?php echo JText::_('COM_VIRTUEMART_SEARCH_RESULTS') . ( str_replace("#39","'","$this->keyword") ? ': ' . str_replace("#39","'","$this->keyword") : '' ); ?></h3>

there is maybe an easier way to do this but I am not so good with the code... the first line converts 39 (which is originated from apostrophes) to #39 and the second line converts #39 to '

my test is done with these parameters and it works for me:
39 (shows only products with real number 39 in SKU, name or any other value that is searchable, (e.g. EAN 9789939999999 or SKU 59397)
or complete product name with ' in one of the words (e.g. Footprints Student's Book)
or only one word from product name with ' (e.g. Student's)

priyaprag