Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Restrict Products to Security Role View modes: 
User avatar
Member
Member
Jezza - 9/21/2009 12:03:52 AM
   
Restrict Products to Security Role
Hi,

A similar question to, rosewebs - "Downloads based on roles or users"
http://devnet.kentico.com/Forums/f36/t10500/Downloads-based-on-roles-or-users.aspx

How do we limit certain products to only be purchased by users in a Security Role?

We want all the products visible and in the Cart to render restricted products in red, set quantity = 0 and disable the quantity field if the user isn't in the necessary Security Role.

Is there a document you can point me to?

Kind regards,

Jeremy
The Construction Site

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 9/22/2009 7:46:57 AM
   
RE:Restrict Products to Security Role
Hi Jeremy,

the easiest way would be to disable the product details for users without the appropriate roles. The restricted product could be in the lists of products but the unauthorized user would be able to read the details. The product details would need to contain the only possibility how to add the product to shopping cart.

Your scenario would need an uneasy development. You would need to re-write the first shopping cart step (its code is in <web site folder>\CMSModules\Ecommerce\Controls\ShoppingCart\ShoppingCartContent.ascx). You may clear the quantity by developing a custom web part with link to shopping cart. You would check the role and according the result it could change the quantity in the query string of link to shopping cart (http://devnet.kentico.com/docs/ecommerceguide/adding_items_to_the_shopping_c.htm).
The API samples of security checking are here: http://devnet.kentico.com/docs/devguide/checking_user_permissions.htm

Best regards,
Helena Grulichova