1

I have used this code in observer function and event i am using is "controller_front_init_before". Problem is due to first line. Please help me to resolve this issue

$customer_session = Mage::getSingleton('customer/session');


            if($customer_session->getId())
            {
            $customer = Mage::getModel("customer/customer")->load($customer_session->getId());
            $group_id = $customer->getGroupId();

            if($group_id==4)
            {

            $core_session = Mage::getSingleton('core/session');
            $LoginTime = $core_session->getLoginTime();

            if($LoginTime)
            {
                $current_datetime = new DateTime();
                $otp_create_time = new DateTime($LoginTime);
                $interval = $current_datetime->diff($otp_create_time);
                $elapsed = $interval->format('%i');

               //Mage::log("elapsed".$elapsed,null,'otp.log');  

                if($elapsed>1440)
                {
                    $core_session->unsLoginTime();
                    $core_session->unsOtp();
                    $core_session->unsOtpCreationTime();

                    $customer_session->logout();
                    $core_session->setExclusive(true);

                    //die('ok');
                    //$core_session->setExclusive(true);

                }
            }
            $LoginTime = $core_session->setLoginTime(date('Y-m-d h:i:s'));
            }



            }

closed as off-topic by Marius Jul 30 '15 at 12:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced OR seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Marius
If this question can be reworded to fit the rules in the help center, please edit the question.

1

Please add config.xml file of your module

Problem should be there. Also, you can read this https://stackoverflow.com/questions/22608376/mage-registry-key-singleton-already-exists-error

Not the answer you're looking for? Browse other questions tagged or ask your own question.