Show Products or Ideally, Product Variants, Based On Role

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 anos atrás
Hello nopCommerce Community!

I'm looking for a way to show different products or product variants based on who is logged in.  So when a user with "VIP" role logs in, I want to show then deep discount items, ideally, I don't want to create new product records, but new variants. for the deep discount items.

How do I show products or ideally, product variants, based on role?

Any help or direction is much appreciated.

Thank you,
Moses
12 anos atrás
moses wrote:
Hello nopCommerce Community!

I'm looking for a way to show different products or product variants based on who is logged in.  So when a user with "VIP" role logs in, I want to show then deep discount items, ideally, I don't want to create new product records, but new variants. for the deep discount items.

How do I show products or ideally, product variants, based on role?

Any help or direction is much appreciated.

Thank you,
Moses

This feature is not available out of the box. You can create a custom plug for ACL for products
12 anos atrás
Hey Eduardo and community,

I appreciate the direction, however, I'm new to nopCommerce.  Is there a sample of an ACL driven feature that I could tailor my solution to?

Again, much appreciated!

Moses
12 anos atrás
You can use "Tier Prices" on products variants to adjust prices per category, but it won't limit what products are visible.  (Maybe an easy "hack" would be to Tier Price to $0, and then modify code to not display $0 items).


@eadameg  - enlighten me on plugin/ACLs  - I can't envision how that can be done.


What I think is missing is an Event for "Select" (Search); then you can create a plugin to handle the event, and modify the IList<product>.
There are events for all the CRUD ops, except the Read
        IConsumer<EntityInserted<Product>>,
        IConsumer<EntityUpdated<Product>>,
        IConsumer<EntityDeleted<Product>>,
12 anos atrás
Hello New York,

I agree... TierPrice is the best way to do it...

I think what I'll do is to set up a new system rule:  if Tier Price exists for 1 unit for a Product Variant, only show that variant to the assigned role.

Items I need to  change...
Add:  IList<ProductVariant> GetProductVariantsByProductIdCustomerId to pass CustomerId to check
Point "some" to GetProductVariantsByProductId to GetProductVariantsByProductIdCustomerId
In new IList<ProductVariant> GetProductVariantsByProductIdCustomerId member, add check:
if exists in TierPrices where unit is 1
then
  if if user is member of roles then show variant
  else hide variant
else
  show variant


Note:  Handle Admin.

Question... when the code is in GetProductVariantsByProductId, is there way to get the CustomerId (or do I need to pass it)?

Thank you,
Moses
12 anos atrás
New York wrote:

@eadameg  - enlighten me on plugin/ACLs  - I can't envision how that can be done.


What I think is missing is an Event for "Select" (Search); then you can create a plugin to handle the event, and modify the IList<product>.
There are events for all the CRUD ops, except the Read
        IConsumer<EntityInserted<Product>>,
        IConsumer<EntityUpdated<Product>>,
        IConsumer<EntityDeleted<Product>>,

Hi New York:
Sorry but I cant go deeper for my limmited experience in IT. v1.9 had ACL on categories which was not carried to v2.x
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.