Magento Forum

   
Page 1 of 2
Restrict Pages by Customer Group (Wholesale Feature)
 
jballotti
Guru
 
Avatar
Total Posts:  339
Joined:  2008-04-20
Chicago area
 

It would be great if Category, Product, and CMS pages could be restricted to specific customer groups. For example, I would want to put products on my store that are only available to wholesale customers in a way that general or guest visitors don’t even know that they’re there. I’d also like to have CMS landing pages that are only available to wholesale customers.

If done is a manner similar to the way that CMS pages are assigned to specific websites/storeviews this could be a very powerful feature.

Thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
 
chanchel
Member
 
Total Posts:  43
Joined:  2008-09-04
 

Amen, I would love to see this same feature for the same reason.

James, after doing some more research I found this extension.  I haven’t tested it, but it might work for you, http://www.magentocommerce.com/extension/reviews/module/635/p/3/

 
Magento Community Magento Community
Magento Community
Magento Community
 
jballotti
Guru
 
Avatar
Total Posts:  339
Joined:  2008-04-20
Chicago area
 
chanchel - 25 March 2009 06:43 AM

Amen, I would love to see this same feature for the same reason.

James, after doing some more research I found this extension.  I haven’t tested it, but it might work for you, http://www.magentocommerce.com/extension/reviews/module/635/p/3/

I’m looking for much more granularity than this extension seems to offer. For example, I would like to be able to designate specific categories and specific products to be available for selected customer groups. I’d also like to be able to designate specific CMS pages for specific groups. But, thanks for the thought.
cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
benz001
Sr. Member
 
Avatar
Total Posts:  238
Joined:  2009-02-05
Sydney
 

For what its worth, this extension now (October 09) does support specific categories and products for selected groups, but still doesn’t let you tie specific CMS pages to groups - that aside it seems to work really well.

One method of blocking out pages unless you logged in as a wholesaler would be to modify this approach http://www.chilipepperdesign.com/2009/07/08/magento-how-to-protect-pages-so-only-logged-in-users-can-view-them

Instead of just checking if they are logged in, you could instead check if they are logged in AND in the wholesale group

$groupId Mage::getSingleton('customer/session')->getCustomerGroupId();
will get you the Customer group ID or 0 if they are not logged in.

So the code on that blog would change to:

$MY_WHOLESALE_GROUPID //replace with the group ID of your particular wholesale group
Mage::getSingleton('customer/session')->setBeforeAuthUrl($this->getRequest()->getRequestUri());  //save requested URL for later redirection
if(Mage::getSingleton('customer/session')->getCustomerGroupId() != $MY_WHOLESALE_GROUPID{  // if not logged in
    
header("Status: 301");
    
header('Location: '.Mage::helper('core/url')->getHomeUrl(customer/account/login)) ;  // send to the login page
    
exit; 
}

Then rather than applying this to the entire site you can use the Layout Update XML of the CMS pages to add it to the root block before the head block only on those pages you want to hide.

You could also use this snippet to hide any links to the CMS pages in your template files that shouldn’t be seen by the general public.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Mentor
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

Hope you will find this module useful, Take a look:
http://www.magentocommerce.com/magento-connect/MagentoPycho/extension/3954/store_restriction

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageParts
Guru
 
Avatar
Total Posts:  415
Joined:  2007-11-18
 

Hi!

We developed an extension which will allow you to restrict individual CMS pages to specific customer groups, or even to specific customers using their customer ids. Hope it helps: http://www.magentocommerce.com/magento-connect/MageParts/extension/3842/restrict_cms_pages

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sander
Sr. Member
 
Avatar
Total Posts:  232
Joined:  2008-01-08
Netherlands
 

Those store restriction modules look good. How well do they work together with Magento Enterprise’s built-in store restrictions?

 
Magento Community Magento Community
Magento Community
Magento Community
 
DanielMiguel
Jr. Member
 
Total Posts:  4
Joined:  2010-08-02
 

My client needed to validate signups, becouse the store we’re building is very exclusive, and every single costumer will be syncronized with their system’s database, so I made some changes on the code posted above to make this happend, using 3 usergroups.

Attention: This code was teste only on the Magento 1.5.0 version

<?php
// Made by Daniel Miguel
// Tag House - www.taghouse.com.br or www.taghouse.us
// Based on chilipepperdesign instructions @http://www.chilipepperdesign.com/2009/07/08/magento-how-to-protect-pages-so-only-logged-in-users-can-view-them
// With others instructions from benz001 http://www.magentocommerce.com/boards/viewthr/viewthread/35774/#t186069

// discover user group ID (if 0 it's not loggedin
 
$groupId Mage::getSingleton('customer/session')->getCustomerGroupId();
// here we will deal whit the variables to make them function as expected 
 
if ($groupId == 1{ $groupAccessName 'Confirmation'// group that is registered, but not approved yet
 
if ($groupId == 0{ $groupAccessName 'Login'// group that is redirected to the login page
 
if ($groupId == 3{ $groupAccessName 'Buy'// group that is able to buy stuff
?>
<?php
Mage
::getSingleton('customer/session')->setBeforeAuthUrl($this->getRequest()->getRequestUri());  // save requested URL for later redirection
if($groupAccessName == 'Login'{  // if not logged in
    
header("Status: 301");
    
header('Location: '.$this->getUrl('customer/account/login'));  // send to the login page
    
exit; 
}
if($groupAccessName == 'Confirmation'{  // if is on the aproval group
    
header("Status: 301");
    
header('Location: '.$this->getUrl('conta-aprovacao')); // send to the awaiting approval page
}if($groupAccessName == 'Buy'{  // can buy!
   // You can post custom code here, maybe not be necessary in most cases
}
 ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageParts
Guru
 
Avatar
Total Posts:  415
Joined:  2007-11-18
 

Hi!

We have also just released an extension which enables you to restrict specific categories to various customer groups: http://www.magentocommerce.com/magento-connect/MageParts/extension/6175/restrict_categories

Hope it helps smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
abellizzi
Jr. Member
 
Total Posts:  8
Joined:  2011-06-09
 

thanks so much for this post… i made the changes just like u showed and it works great… valeuu

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Mentor
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

Hi James

You may be interested in following B2B extensions for magento:
Store Restriction Pro
Custom Login Redirect Pro

Regards
MagePsycho

 
Magento Community Magento Community
Magento Community
Magento Community
 
magecoders
Member
 
Avatar
Total Posts:  42
Joined:  2011-10-24
 

Hi,

Checkout our new extension “CMS Filter” which provides you to set restriction by customer groups for CMS Pages and CMS static blocks. Also include mass cms pages and cms static block update in admin

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

Regards,
MageCoders

 
Magento Community Magento Community
Magento Community
Magento Community
 
ehime
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2010-07-02
 

I can confirm that permutation of Daniels code works on Enterprise 1.10

 
Magento Community Magento Community
Magento Community
Magento Community
 
souljas
Jr. Member
 
Total Posts:  5
Joined:  2010-11-07
 

Hey nice mod. Just one question.... I am trying to make the footer links open to the public. There are 2 files where I think the <remove name="auth-redirect" /> might work -

/layout/page.xml.

<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">    
                <
block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">  
                    <
label>Page Footer</label>     
                    <
action method="setElementClass"><value>bottom-container</value></action
                </
block>
                <
block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
                <
block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>   
             
            </
block>

/layout/cms.xml

<default>                       
        <
reference name="footer">         
            <
block type="cms/block" name="cms_footer_links" before="footer_links">
                <!--
                    
The content of this block is taken from the database by its block_id.
                    
You can manage it in admin CMS -> Static Blocks
                
-->                                                       
                 
                <
action method="setBlockId"><block_id>footer_links</block_id></action>   
            </
block>
        </
reference>        
    </default>

When I add the <remove name="auth-redirect" /> to them I get the footer links to be available to the public but the whole site does too! I cant seem to selectively open the footer links.

I have been successful in opening the homepage to the public with this alteration to cms.xml

<cms_index_index translate="label">
        <
label>CMS Home Page</label>   
        <
remove name="auth-redirect" />        
    </
cms_index_index>

 
Magento Community Magento Community
Magento Community
Magento Community
 
johnny_n
Jr. Member
 
Total Posts:  13
Joined:  2012-06-12
 

I’m trying to redirect the home pages for everyone but customer group = 4.  I’ve used the chilipepper solution for the php, so I’ve got a .phtml file:

<?php $MY_GROUPID = 4 // redirect everyone but group to public homepage

Mage::getSingleton('customer/session')->setBeforeAuthUrl($this->getRequest()->getRequestUri());  //save requested URL for later redirection
if(Mage::getSingleton('customer/session')->getCustomerGroupId() != $MY_GROUPID) {  // if not my group
  header("Status: 301");
  header('Location: '.$this->getUrl('public-home')) ;  // send to the public homepage
  exit; 
}
?>

In the home page Layout Update XML, I’ve added:

<reference name="root">
<
block type="page/html" name="auth-redirect" as="auth-redirect" template="page/html/auth-redirect.phtml"/>
</
reference>

But no joy.  It’s not loading the php file… does anyone have any idea what’s happening?

Magento 1.7.0.2.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Finder
Jr. Member
 
Total Posts:  3
Joined:  2012-08-07
 

Try AITOC’s Splash Page module which possibly is able to solve your issues. http://www.aitoc.com/en/magentomods_splash_page.html

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2