Imran Khan
Imran Khan

Reputation: 109

Restrict user to view product in magento

What is the best way to restrict product detail page for logged in user?

Upvotes: 2

Views: 705

Answers (3)

devopensource
devopensource

Reputation: 133

<?php 
   if(Mage::getSingleton('customer/session')->isLoggedIn()){ 
      echo "loggein user";
   else{
      echo "no loggein user";
   }
?> 

Upvotes: 0

Imran Khan
Imran Khan

Reputation: 109

Thanks guyes for your reply. I found one more option to do that by adding your restricted referance < remove name="wishlist_sidebar" >< /remove >
in this tag < customer_logged_out > at customer.xml. now if customer is logged out he will not see the wishlist_sidbar block. What you say about this approch.

Upvotes: 0

Anton S
Anton S

Reputation: 12750

add the login check to controller, or if you must then to the view with the following condition

$this->helper('customer')->isLoggedIn();

Upvotes: 1

Related Questions