- Posts: 1195
- Thank you received: 13
Hide products from search for public users
2 years 9 months ago #359113
by verzevoul
Hide products from search for public users was created by verzevoul
-- 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
-- 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.
2 years 9 months ago #359117
by nicolas
Replied by nicolas on topic Hide products from search for public users
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:
to:
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.
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:
Code:
$children = $categoryClass->getChildren($pageInfo->filter->cid,true,array(),'',0,0);
Code:
$categoryFilters = array('a.category_published=1');
hikashop_addACLFilters($categoryFilters,'category_access', 'a');
$children = $categoryClass->getChildren($pageInfo->filter->cid,true, $categoryFilters,'',0,0);
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.
2 years 9 months ago #359131
by verzevoul
Replied by verzevoul on topic Hide products from search for public users
Hi!
It didn't work i still see the product.
I could give you access if you want?
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.
2 years 9 months ago #359134
by nicolas
Replied by nicolas on topic Hide products from search for public users
Hi,
Yes, please provide a backend and a FTP access.
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.
2 years 9 months ago #359162
by verzevoul
Replied by verzevoul on topic Hide products from search for public users
I did.
Thank you!
Thank you!
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 611
- Thank you received: 13
2 years 9 months ago #359164
by mohairbears
Replied by mohairbears on topic Hide products from search for public users
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
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.
2 years 9 months ago #359175
by nicolas
Replied by nicolas on topic Hide products from search for public users
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.
@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.
2 years 9 months ago #359177
by verzevoul
Replied by verzevoul on topic Hide products from search for public users
Hi!
Ah i didn't know i could change the category's access level!
It works yes.
Thank you!
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.065 seconds