News:

Looking for documentation? Take a look on our wiki

Main Menu

3.2.4 product search broken

Started by Ghost, October 30, 2017, 17:28:01 PM

Previous topic - Next topic

Ghost

Product search doesn't work properly when changing ordering, page or limit. This can be seen in demo site. Enter a keyword, e.g. "helmet". You'll get 1 result:

http://demo.virtuemart.net/?keyword=helmet&view=category&option=com_virtuemart&virtuemart_category_id=0&Itemid=121

Change ordering and you'll end up on this page:

http://demo.virtuemart.net/helmet/by,product_name

Keyword is ignored and all products are shown.

Search param is missing from URL, used to be like this in older versions: http://demo.virtuemart.net/search/helmet/by,product_name

AntonioS28

hi
i've the same problem. Did you solve it?
on my site www.alessandrocarella.it there is the same bug, if i try to find a product with the name or the sku the risult is a page with many last objects...

Ghost

As a temporary fix I commented out keyword routing in router.php.

Ghost

#3
There is another problem when searching. Ordering list and manufacturer lists strip out spaces. Try searching for "test keyword". The links on search result end up changing the keyword to "testkeyword"which breaks search functionality. Problem seems to be in vRequest filterUrl method.

Milbo

Quote from: Ghost on November 10, 2017, 10:00:11 AM
As a temporary fix I commented out keyword routing in router.php.

After fuddling with it almost an hour, I decided to just uncomment it. It makes not really sense to translate it. The fix is in the svn. The spaces are still removed, hmm.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/


Milbo

I solved the problem with the spaces. It was a filter issue.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ghost

Thanks.

But regarding search links, router changes are not needed here. It's just something I used as a quick temporary fix. It's also not B/C friendly (old links with keywords no longer work with this change).

The problem is simply missing search=true param in search form here https://dev.virtuemart.net/projects/virtuemart/repository/entry/branches/com_virtuemart.3.0.12.4/components/com_virtuemart/views/category/tmpl/default.php#L88.
Should be same as in search module (https://dev.virtuemart.net/projects/virtuemart/repository/entry/branches/com_virtuemart.3.0.12.4/modules/mod_virtuemart_search/tmpl/default.php#L4).

Milbo

The problem is in the router. The param keyword=mywordtolookfor is changed to /search/ymywordtolookfor

and that creates trouble
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ghost

#9
There's no trouble there. It always worked like that. The problem is when param search=true is not added. Then keyword=mywordtolookfor becomes simply /mywordtolookfor and that doesn't work.

I went through code history and found when it was broken, in 9267 http://dev.virtuemart.net/projects/virtuemart/repository/revisions/9267/diff/branches/com_virtuemart.3.0.12.4/components/com_virtuemart/views/category/tmpl/default.php.

There was no search param in form URL but there was an input named search. Removing it causes the issue.
<input type="hidden" name="search" value="true"/>It needs to be added back, either as input or as part of form action URL.

Milbo

#10
No. This here "/search/mywordtolookfor" is unsolvable. The order of the URL makes it so complex, in special when you want to sort your result. The value is set within the router

if ( $helper->compareKey($segments[0] ,'search') ) {
$vars['search'] = 'true';


When you see the whole thing as function between sets, then you will notice that the construction "/search/mywordtolookfor" creates a lot problems. You lose too much information. So it is impossible to differ by format between a search and a category "search" with subcategory "mywordtolookfor". In special, when you search for something like "search" =>"search/search". When you search the first time, the URL has no keyword search, the next time it has the keyword search. The keyword comes one time from the URL (GET), the other time from the form. So one time I just can add it, the other time, the URL has the search already, and I must replace it. It would be simple, when it is one segment, but I would have to check between different segments....

I really do not see the point to SEF a search. Or even more funny, a /search=mywordtolookfor/ is better than "/search/mywordtolookfor". Because the first construction is understood as search.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ghost

I see. But I don't think you should make this change at this point. It's not backwards compatible at all. Sites will break for many users who use links to search results. E.g. some users might have links to a page like http://demo.virtuemart.net/search/helmet and now it doesn't function properly.

Milbo

This is correct. But a link with a search is most time not really used. Maybe customer sends such a link to a friend, but I doubt that such a link is a "long term" link.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

Quote
, a /search=mywordtolookfor/ is better than "/search/mywordtolookfor". Because the first construction is understood as search.

I meant with this, that searchengines maybe understand the normal key-value pair as search, while the other construction could be recognised as "whatever".
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/