Author Topic: 3.2.4 product search broken  (Read 385 times)

Ghost

  • Jr. Member
  • **
  • Posts: 367
3.2.4 product search broken
« on: October 30, 2017, 17:28:01 pm »
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

  • Beginner
  • *
  • Posts: 9
  • A beginner
Re: 3.2.4 product search broken
« Reply #1 on: November 07, 2017, 12:31:24 pm »
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

  • Jr. Member
  • **
  • Posts: 367
Re: 3.2.4 product search broken
« Reply #2 on: November 10, 2017, 10:00:11 am »
As a temporary fix I commented out keyword routing in router.php.

Ghost

  • Jr. Member
  • **
  • Posts: 367
Re: 3.2.4 product search broken
« Reply #3 on: November 10, 2017, 10:08:03 am »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9372
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 3.2.4 product search broken
« Reply #4 on: November 14, 2017, 19:33:54 pm »
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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ghost

  • Jr. Member
  • **
  • Posts: 367

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9372
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 3.2.4 product search broken
« Reply #6 on: November 15, 2017, 11:57:16 am »
I solved the problem with the spaces. It was a filter issue.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ghost

  • Jr. Member
  • **
  • Posts: 367
Re: 3.2.4 product search broken
« Reply #7 on: November 15, 2017, 13:59:59 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9372
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 3.2.4 product search broken
« Reply #8 on: November 15, 2017, 16:02:01 pm »
The problem is in the router. The param keyword=mywordtolookfor is changed to /search/ymywordtolookfor

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

Ghost

  • Jr. Member
  • **
  • Posts: 367
Re: 3.2.4 product search broken
« Reply #9 on: November 15, 2017, 18:54:37 pm »
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.
Code: [Select]
<input type="hidden" name="search" value="true"/>It needs to be added back, either as input or as part of form action URL.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9372
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 3.2.4 product search broken
« Reply #10 on: November 16, 2017, 09:38:59 am »
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
Code: [Select]
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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Ghost

  • Jr. Member
  • **
  • Posts: 367
Re: 3.2.4 product search broken
« Reply #11 on: November 16, 2017, 10:15:04 am »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9372
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 3.2.4 product search broken
« Reply #12 on: November 16, 2017, 11:52:05 am »
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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9372
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: 3.2.4 product search broken
« Reply #13 on: November 16, 2017, 11:54:36 am »
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".
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/