Thursday 20 October 2011

To display the list of product from particular category if it's login.


To display the list of product from particular category  if it's login.

Check the condition of category( example :  "category id 11" ) if it's login or not...

<?php


if(Mage::registry('current_category')) {
$currentCategory = Mage::registry('current_category');
$categoryId = $currentCategory->getId();
$restrictId = 11;
           
if($categoryId == $restrictId) {
$login = Mage::getSingleton( 'customer/session' )->isLoggedIn();
$redirectUrl = Mage::getBaseUrl().'customer/account/login';
if(!$login) { ?>        
<script type="text/javascript">
this.location.href = '<?php echo $redirectUrl; ?>';
</script>
<?php 
}
}
        
}
?>

No comments:

Post a Comment