Here I am presenting a list of some useful code snippets for Magento developers that are required here and there in code development. These are the most frequently used code snippets that can sometimes eat up a lot of your time. So here is the collection…
1. Check if customer is logged in:
if(!Mage::getSingleton('customer/session')->isLoggedIn())
{
$this->_redirect('customer/account/login/');
}
2. Get current site url:

