Seite 1 von 1

Modifying and displaying product list if logged in, + others criterias

Verfasst: 21. Mai 2015, 17:21
von vmulot
Hello,

i have got a new question for product displaying.
Some of the products don't have a price or at least have 0.0000 because they are very specific.

If customers aren't logged in, it's fine, all products are here even if price is at 0.0000

If customer is logged in, i need to "filter" product list, so he can't see/access product with price at 0.0000, even when performing a search.

any idea ?

atm i'm using a hook you gave me "myBeforeProductlistOutputBeforePagination".
but when doing a search, or if i know the product url, i can see it.

any how to ? suggestions ? is it posible ?

thanks!
regards

Re: Modifying and displaying product list if logged in, + others criterias

Verfasst: 22. Mai 2015, 01:04
von supportteam2
I'm not sure if I understand correctly. I assume that you managed to filter out the products that you want to hide, using the hook "myBeforeProductlistOutputBeforePagination" but if someone knows the exact url to the product, he can open the url and see the product that you don't want to show him. If the user doesn't know the url he might still find the product using the standard contao search (not the Merconis product search because in this case your custom filter logic comes into play).

Did I get it right? If so, the problem only exists with product detail pages. Product overview pages should not display the products that you want to hide, because the hook works there.

I would suggest that you add some code to the product details template to check if the user is logged in and if there's a reason not to display the product. In this case you could hide the actual product information and show some sort of message or you could redirect to another page, maybe the 404 error page.

It's probably a little bit "cleaner" to use the hook "beforeProductSingleviewOutput" to figure out if a product must not be displayed and then redirect to an error page but doing it in the product details template is much easier so I strongly suggest that you do it there.

Re: Modifying and displaying product list if logged in, + others criterias

Verfasst: 22. Mai 2015, 09:25
von vmulot
Ok, that's what i was thinking, thanks for helping !