smart search problem

  • Posts: 120
  • Thank you received: 5
1 month 2 weeks ago #362226

-- HikaShop version -- : 5.1.0
-- Joomla version -- : 5.1.2
-- PHP version -- : 8.2

I have 2 problems with Joomla smart search:
1- When I search for a product, even though the Search variants option is set to No in the settings of the Search - Hikashop Products plugin, it shows the variants.
2- It also displays the products that are not published in the search results, and because the product is not published, when the user clicks on the search result, it gives a 404 error. If you don't have to display unpublished products in the search results.



results:

Attachments:
Last edit: 1 month 2 weeks ago by levelup.

Please Log in or Create an account to join the conversation.

  • Posts: 82308
  • Thank you received: 13257
  • MODERATOR
1 month 2 weeks ago #362232

Hi,

1. There is no option "search variants" for the Smart search.
The Smart search uses plugins from the "finder" group, not plugins of the "search" group.
This plugin of the "search" group is for the old search system of Joomla, which has been removed with Joomla 4.
So this is the normal behavior.

2. I am not able to reproduce this behavior on my end. If I unpublish a product from the backend product listing toggle, or by editing the product it works fine.
How are you unpublishing the product ? Are you doing it via the HikaShop interface ? Where exactly ? Is it somehow linked to the products having variants ?

Please Log in or Create an account to join the conversation.

  • Posts: 424
  • Thank you received: 19
1 month 2 weeks ago #362242

If you don't want variants to be displayed, add this code to the plugins/finder/hikashop/hikashop.php file. Looking for

protected function getListQuery($query = null)
and you add this code
$query->where('a.product_type = ' . $db->quote('main'));
before
return $query;

You can also add extra things to display in this function, but you have to be aware of what you're doing and remember that if you reinstall HikaShop, your changes will be lost.

Last edit: 1 month 2 weeks ago by neo191987.
The following user(s) said Thank You: nicolas, levelup

Please Log in or Create an account to join the conversation.

  • Posts: 120
  • Thank you received: 5
1 month 2 weeks ago #362248

nicolas wrote: 1. There is no option "search variants" for the Smart search.
The Smart search uses plugins from the "finder" group, not plugins of the "search" group.
This plugin of the "search" group is for the old search system of Joomla, which has been removed with Joomla 4.
So this is the normal behavior.


I think it would be better to have an option to exclude variants from the search results.

nicolas wrote: How are you unpublishing the product ? Are you doing it via the HikaShop interface ? Is it somehow linked to the products having variants ?


Yes. The main product has been unpublished by HikaShop interface, but since it has two variant products, it will display the variant product in the search results.

Please Log in or Create an account to join the conversation.

  • Posts: 82308
  • Thank you received: 13257
  • MODERATOR
1 month 2 weeks ago #362252

Hi,

1. Adding an option for this is a possibility, yes. Thanks for your feedback.

2. Ok, now I understand the problem. It's the variants of the unpublished product which are displayed in the search results, not the product itself. I was able to reproduce the issue on my end and made a patch for it. Download again the install package of HikaShop on our website and install it on yours and you'll have the patch. Note that it won't change anything for already unpublished products. You would have to reindex them, or publish/unpublish them.

The following user(s) said Thank You: levelup

Please Log in or Create an account to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum