Hide products from search for public users

  • Posts: 1028
  • Thank you received: 11
  • Hikashop Business
2 months 2 weeks ago #359113

-- HikaShop version -- : 4.7.1
-- Joomla version -- : 3.10.12

Hi,

I have a category accessed only by registered users but if i search a product from that category as a public user i see the product.
So how can i hide all products from this category from public users?

Thank you

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

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
2 months 2 weeks ago #359117

Hi,

So I understand you're using the filter system of HikaShop for your search. And thus you're using with it a menu item configured to display all the products, upon which the filtering is done. I think that's where the issue. When the system loads the sub categories of the menu item, in order to then load the products of these categories, it doesn't add a check on the access level of those categories.
Try changing the line:

$children = $categoryClass->getChildren($pageInfo->filter->cid,true,array(),'',0,0);
to:
$categoryFilters = array('a.category_published=1');
hikashop_addACLFilters($categoryFilters,'category_access', 'a');
$children = $categoryClass->getChildren($pageInfo->filter->cid,true, $categoryFilters,'',0,0);
in the file components/com_hikashop/views/product/view.html.php and it should then take the access level of the sub categories into account.
Please let us know how it goes so that we can include the change for the next release of HikaShop.

The following user(s) said Thank You: verzevoul

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

  • Posts: 1028
  • Thank you received: 11
  • Hikashop Business
2 months 2 weeks ago #359131

Hi!

It didn't work i still see the product.
I could give you access if you want?

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

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
2 months 2 weeks ago #359134

Hi,

Yes, please provide a backend and a FTP access.

The following user(s) said Thank You: verzevoul

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

  • Posts: 1028
  • Thank you received: 11
  • Hikashop Business
2 months 1 week ago #359162

I did.

Thank you!

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

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
2 months 1 week ago #359164

Hi, I have a similar issue.

Category set to access by Administrator and Super Users only.

It is used for expired products that still need to be accessed for reference and when products come back into stock.

By using the search (smart search) it will still show the product but you get a 404 error? biggest issue with this is the bots are crawling these links and giving me loads of error notices?

Tried blocking the category to the bots with no joy?

thanks

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

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
2 months 1 week ago #359175

Hi,

@verzevoul
Thanks for your access, however I don't see the problem on your website.
You provided the example of the product on the page /en/searching-results/product/lavens-straps-rubber-strap-straight-18-20-22mm
If I look for this product in your backend, I can see that it is linked to the category "Λουράκια Σιλικόνης - PVC - PU"
This category is published and its access level is set to "all".
So it is normal that it shows up in the search results.
If I unpublish this category, or if I change its access level to a specific user group, then the product doesn't appear on the result page:
/en/searching-results/product/listing?filter__1=LaVens+Straps+Rubber+Strap+Straight+18-20-22mm
So it seems to be working as expected.

@mohairbears
Without more precise information I can't say much. Can you provide the URL of the search page ? Can you provide an example of product with the issue ? Can you provide a screenshot of its settings ?
Please open a new thread so that we can discuss this separately.

The following user(s) said Thank You: verzevoul

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

  • Posts: 1028
  • Thank you received: 11
  • Hikashop Business
2 months 1 week ago #359177

Hi!

Ah i didn't know i could change the category's access level!

It works yes.

Thank you!

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

Time to create page: 0.082 seconds
Powered by Kunena Forum