Problem search with Universal AJAX live search

Phoca Cart - complex e-commerce extension
User avatar
ehndrju
Phoca Member
Phoca Member
Posts: 43
Joined: 21 Apr 2021, 05:35

Problem search with Universal AJAX live search

Post by ehndrju »

Hello Jan.
I have a plugin Universal AJAX live search installed.
When searching for a product, it incorrectly gives a link to the product in the subcategory.
More details on how it works:

i have 6 item
  • "sf 12012" in subcategory
  • "sf 12022" in parent category
  • "sf 12045" in subcategory
  • "sf 1207" in subcategory
  • "sf 1212" in subcategory
  • "sf 1217" in subcategory
I am doing a search by "sf 12"
find 6 item
only this "sf 12022" has the correct link, because in parent category
if move other item to parent category - everything is fine.
  • link from result search: /component/phocacart/item/bloki-pitaniya/prochie-bp-i-akkumulyatory/akkumulyator-sf-12012
  • real link to product: /directory/dc-adapter/prochie-bp-i-akkumulyatory/akkumulyator-sf-12012
This is the question I asked the plugin vendor. He answered me:
The problem is that in our search plugin, we use a default Phoca cart function for generate the products url.
Please contact with the developers of Phoca Cart about how to fix the function called getItemRoute to make it work for the products which are in a subcategory:
PhocacartRoute::getItemRoute($value->id, $value->catid, $value->alias, $value->catalias)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Problem search with Universal AJAX live search

Post by Jan »

Hi,

the function:

Code: Select all

$link 		= JRoute::_(PhocacartRoute::getItemRoute($v->id, $v->catid, $v->alias, $v->catalias));
adds the standard category tree to the URL and makes it as SEF link. See the image:

Image

1) product "hava" is searched
2) it is found and displayed in items view (which means no connection to any category, items view displays all items from all categories)
3) when you hover over the image which is a link to detail view, then the standard SEF link including all the folder structure is created (see the bottom of browser URL)

I don't have a contact to developer of this extension, but try to ask if JRoute::_ is used when the link is created

Following variables are included in the function:

id => 1
alias => hava
catid => 3
catalias => subcategory

So it means, no category tree is needed, such is built in getItemRoute, but it needs to be used with JRoute::_ method.

Jan
If you find Phoca extensions useful, please support the project
Post Reply