Total Posts: 126
My client needs to disable the viewing of all products in a specific category unless the user is logged in. There is a plug-in out there that completely disables the category, but that also means removing it from the navigation, and not telling the user they can’t see the contents because they are not logged in. I just wanted to share what I did if others are looking for a similar solution. It’s a down and dirty solution, but it works…
<?php $disallowCategories = array(14); ?>
<?php if(in_array($this->getCurrentCategory()->getId(), $disallowCategories) and Mage::getSingleton( 'customer/session' )->isLoggedIn() == 0): ?>
<p>Sorry, you need to be logged in to view <?php echo $this->getCurrentCategory()->getName(); ?>.</p>
<p><a href="/catalog/customer/account/login">Login or create an account</a></p>
<?php else: ?>
... rest of file's code...
<?php endif; ?>
Note that this will not stop the user from directly accessing the products if they know the URL, but in my client’s case, it isn’t a big deal if the user does this.