Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Restrict catalog access to registered users (or certain groups)
 
oldskool73
Jr. Member
 
Total Posts:  9
Joined:  2008-06-25
 

Hi all,

just discovered Magento and it seems to be a nice bit of software, I’m just trying to get my head into customising the code.

My client sells wholesale to manufacturers only and requires some specific customisations, the most important being that only registered and approved (placed in the ‘wholesale’ group) users can view the contents of the catalog.

I know this isn’t a feature in the current or release or svn, but I’ve seen a few others mentioning they need this or have done this already, is there any pointers or existing code anyone knows of?

If not, I’m thinking rudimentary support should be fairly easy to hack in, I just need to find where to insert a permissions check at the start of building every catalog related page, and redirect to a custom cms page. Any pointers on…

* where to put this permission check
* how to check if the page being built is a catalog page
* how to check if the user is logged in
* how to check if the user is in a certain login group
* how to redirect to a cms page

...would be great smile

Cheers!

 
Magento Community Magento Community
Magento Community
Magento Community
 
kalqlate
Jr. Member
 
Total Posts:  26
Joined:  2008-06-17
 

Hey oldskool,

Welcome to Magento Skool. grin

** ** Just reread you post after having written all of what follows, and it all still applies. However, in your case you will simply create your catalogs and make them “Is Active” = No for the main website and Yes for the “limiting” website. Read below to understand what I just said. Actually, if there were simply a “Must Be Logged In To View Catalog” setting on the Store admin page then you’d be set. But this is not the case. ** **

Currently, as far as I know, Customer Groups is not used to limit access to sites, stores, or categories, but functions more for putting customers in pricing categories. Quick limiting of a customer group to a category would be great timesaving feature. Instead, It appears that each customer account must be assigned to a website when the customer account is CREATED.

I have the solution for you using the current Magento functionality, but it appears to be a bit buggy at the moment, unfortunately. I’ll explain in a bit.

Perhaps you can give it a try to see if you can have better luck.

1) Currently, you’ll have to set up a second entry point for these members which involves setting up a second website. Don’t panic! It’ doesn’t have to be wholely separate website. A subfolder of your main website will do, but it MUST be set up as a “website” as apposed to a store or store view beneath your Main Website. This is due to the fact that customer members are assigned to websites, not stores or store views. Perform the functions in the following link to create a second website/store:

http://www.magentocommerce.com/boards/viewreply/25061/

2) Test that you have correctly created you new store view by going to http://www.your_website_name/limited_store_name. If you receive a 404 error then revisit step 1.

3) Limit the categories in that store. Assuming that you have already created the category which you want the particular set of customers to be limited to, from the admin page do the following:

a) Catalog->Manage Categories
b) Select the store view that you just created in step 1 with the pull down at the upper-left
c) For EACH category that you DO NOT want displayed for the selected store view
i. Scroll down to “Is Active”, uncheck “Use Default Value”, set the dropdown value to “No”
ii. Click “Save Category” at the upper-right.
d) Test that all is correct so far by viewing http://www.your_website_name.com/limited_store_name and you should see that only the IS ACTIVE categories are available in your catalog menus. If not, revisit the steps above.

4) Back to Admin,

a) Select Customers->Manage Customers
b) Click “Add New Customer”
c) Select website to which the customer will be registered with the “Creat In” pulldown list. Understand that “Create In” means exactly what it says. You will not be able to edit this field after the customer acciybt is Created In a particular website.
d) Enter the name and email information.
e) Select a customer group which, again, has more to do with a pricing category and nothing to do with catalog category access.
f) Enter a password or check “Send auto-generated password” if you would rather that the member manage their password.
g) Click “Save Customer” at the upper-right

5) Now go to http://www.your_website_name.com/limited_store_name and click “login” and enter the email address and password of the user just created in the limited store. The dashboard for that user should come up.

Well, that’s what is supposed to happen. What happens on my machine is that SOMETIMES the user is logged in to the correct dashboard on the limited website and only have access to the allowed product categories. Other times they are logged in to the MAIN website and have full travel over all within. Now, this error could be something peculiar to my installation and actions that I have performed susequently, so your mileage may vary.

If having your limited category members go to a sub page is not to your liking then you may overcome this by having a dropdown “Select your group to Log In” and filled with all of the “group” names in it at the upper-right of your home page in place of the “Log In” link. Upon select, your JS can redirect to the proper login for that group - http://www.your_website_name.com/selected_limited_group_name/customer/login/

Best of luck!
David

 
Magento Community Magento Community
Magento Community
Magento Community
 
paderEpiktet
Member
 
Avatar
Total Posts:  36
Joined:  2010-11-04
Germany
 

Hello David,

yes, you are right,

* websites can have a limited access to the category tree(s),
* and customers can be assinged to websites
* and therefore custumers of different websites can have different/restricted views an the categories

but that does not really fullfill one central need of a whole salers shop to have a different visibility of the catalog for

* users that are logged in

and

* and users that are not logged in.

But this feature of limited catalog access is available in the enterprise edition which enables B2B commerce.

With best regards,

Andreas

 
Magento Community Magento Community
Magento Community
Magento Community
 
mikeonmage
Sr. Member
 
Total Posts:  101
Joined:  2011-02-03
 

this is the only clear description i have seen about what magneto can do with groups VS websites -

and its too bad its sooo much work and trouble just to send Group A to Store A and Group B to Store B!!!!!

Has this changed?

Its all I want

send Group A to Store A and Group B to Store B!!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kedeesofttech
Jr. Member
 
Avatar
Total Posts:  25
Joined:  2012-05-22
 

Hi,

Want to restrict the customer to show your site without login..?

Here is the nice extension. it will allow you to choose which page to restrict..

http://www.magentocommerce.com/magento-connect/catalog/product/view/id/13793/
grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
FocusExtensions
Jr. Member
 
Avatar
Total Posts:  2
Joined:  2013-08-12
United States
 

If you would like to restrict access to CMS pages based on the users group, we have an awesome extension that does just that! http://www.focusextensions.com/magento-extensions/group-permissions - check it out smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
innoexts
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2011-02-10
 

Customer Groups Manager extension makes possible to restrict catalog access to customer groups:
http://innoexts.com/promotion/customer-group/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

hi!
This is right solution for you - Customer Group Catalog extension.Manage visibility of specific categories and products by customer groups. Configure product price visibility on product and category pages.

For more details, user guide and live demo please follow the link - http://amasty.com/customer-group-catalog.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
sopedro
Jr. Member
 
Total Posts:  17
Joined:  2011-12-06
 

Hi to all,

Theres is a simple way.
In Backend, select system->configuration->customers->customer configuration and under the account sharing options select “by site”, then instal webdeveloper toolbar to firefox and open each customer you want to be able to access the site and in the developer tolbar select “enable form fields”, so....you can select the website....
I have 4 website and one of then is b2b na d i just want some customers to acces them so, i do this way and it works fine…

Regards,

pedro

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles_MS
Sr. Member
 
Avatar
Total Posts:  87
Joined:  2013-11-17
 

nice post wink Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
Monty_iLM
Guru
 
Total Posts:  450
Joined:  2013-11-05
 

Hi,

There a couple of modules out there for restricting access to your catalog for logged in users only but I find it easier to add a couple of lines of code to get the job done. It involves using the customer helper to check if the user is logged in. I think what the helper method does is check for a user session ID and returns true or false depending on if it exists. What I’ve done here is add a little extra bit to check if the user is logged in AND it is a specific category because maybe we want restrict some products to only be viewed if the user is online.

If the user is NOT logged in and the category has the ID of 12 then set an error message and redirect them back to the homepage.

To use this add this code to the top of catalog/category/view.phtml

<?php
$_category 
Mage::registry('current_category');
 
$id $_category->getId();
 
if(!
$this->helper('customer')->isLoggedIn() && $id == 5):
 
        
$message $this->__('You need to be a logged-in member to access our catalog');
 
        
Mage::getSingleton('core/session')->addError($message);
 
        
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl(''$arguments= array()));
 
 endif;
?>

Hope this will help you!!

Thanks

Monty
iLoveMage

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top