Hiding Products based on Customer Role

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Hello,
Is there a way to configure the hiding of (or at least the inability to purchase) products depending on Customer Roles?
If there is nothing like this existing, what would be the best place to add this logic programmatically?
Thanks in advance!
13 years ago
microfirmz wrote:
Hello,
Is there a way to configure the hiding of (or at least the inability to purchase) products depending on Customer Roles?
If there is nothing like this existing, what would be the best place to add this logic programmatically?
Thanks in advance!


No, right now there is no feature in nopCommerce by which you can accomplish this

from your admin section you can dis-able buy button but that will be applicable for all customers.

If you want to add this feature, you have to modify the current project according to your requirement

Your Question: what would be the best place to add this logic programmatically ?

Answer: Currently nopCommerce has got a feature : "Access control list", it works on the bases of roles (just like you're looking for) BUT it works only for admin section right now, This is the control that you can modify according to your requirements.

In the source you can take a look at the structure of this feature which will give you an idea how it works...
13 years ago
There are a couple of ways of doing this I would suspect, you can find all places where the add to cart button is displayed and hide it if your role does not have the rights to purchase the product.

You can also add it to the function that adds a product to the cart and display a message to the customer if he is not allowed to purchase the item.

There is functionality easly accessible to handle the customer roles, just a quick call to:
CustomerManager.GetCustomerRolesByCustomerId(int customerId)

Then just loop through that collection to see if the customer has the right to purchase the item.

BR
Joakim
13 years ago
I am going to attempt to do this today.
I will let you know who it goes
13 years ago
As I see it,
It's possible to do this, but will require me to modify the core product selection stored procedure [Nop_ProductLoadAllPaged].
My plan is to pass a customer identifier into this sproc and adjust it's design to query tables based on a new join that I setup that defines customers to groups
13 years ago
NopCommerce team have update the change set for 1.9 version and it will include the following functionality if this is what you;re looking for:

"Allow store owner to manage catalog access by customer role. A store owner can deny access to any customer role. A store owner can manage access to categories but this ACL (per object) implementation can be easily extended to manufaturers and so on "

http://nopcommerce.codeplex.com/SourceControl/list/changesets
13 years ago
This is great news, as I'm just not crazy about making that deep of a change to my installations :)
Ill hold off for version 1.9
13 years ago
I know it's not polite to ask this, but is there any ETA as to when 1.9 will be available?
I saw on codeplex that there was no data set, but I also saw that there have been 2 releases since June.

Thanks,
13 years ago
johnrossitter wrote:
This is great news, as I'm just not crazy about making that deep of a change to my installations :)
Ill hold off for version 1.9


The changeset is ready to download, you can still download and test it: http://nopcommerce.codeplex.com/SourceControl/changeset/changes/57739

but yes if you want stable version then it's better to wait for 1.9version
13 years ago
I will look into it.

Thanks a Bunch
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.