Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • fabrice 104 posts 227 karma points
    Apr 29, 2014 @ 10:02
    fabrice
    0

    Restrict some products to logged in members

    Hello,

    I would like to restrict some products only to logged in users.

    For the product page itseft, I can use the build in "Public Access" from Umbraco. But for the front page and categories pages, I'd like to only show public products.

    It there a clever way to do it ? Or should I use "Catalog.GetAllProducts()" and for each product, check if the product is allowed.

    I was thinking of adding a "memberGroupPicker" data type to the product doc type so I could do something like : Catalog.GetAllProducts().Where(p => p.GetProperty("GroupMemberPicker") == xx)

    What do you think ?

    Thank you very much

  • uWebshop 35 posts 140 karma points
    Apr 29, 2014 @ 12:54
    uWebshop
    0

    Hi,

    uWebshop by default does not let vistors visit pages that are protected, but indeed does show them when you requests all products for example in the menu (so you can link to them).

    You can simply use the HasAccess function in the Umbraco Library API to check the permission.
    Information about that can be found here: http://umbraco.com/follow-us/blog-archive/2011/3/13/umbraco-razor-feature-walkthrough-part-5.aspx

    Best,

    Arnold 

Please Sign in or register to post replies

Write your reply to:

Draft