Search This Blog

Oct 2, 2012

Magento: How to check if User is logged in

There are some instances that you want to offer a coupon code or private sales in your site. In order to for you to do that you need to check if the user logged in using the following code:

<?php if(Mage::getSingleton('customer/session')->isLoggedIn()): ?>

 //paste your coupon code or private information here. 

<?php endif; ?>

Also you can use this helper method. It does exactly the same as abov

<?php if($this->helper('customer')->isLoggedIn()): ?>

 //paste your coupon code or private information here. 

<?php endif; ?>

1 comments:

Anonymous said...

I am extremely impressed with your writing skills as well as
with the format in your weblog. Is that this a
paid subject matter or did you customize it your self?
Either way keep up the nice high quality
writing, it is uncommon to peer a great weblog like this one nowadays..


Here is my webpage vps with senukeXcr