-1

I want to keep a log of all the customer sessions generated in magento. How is it possible? I am thinking in terms of an event being generated when customer sessions are created. Of course, It will be a custom event. Is there a way?

  • Have you investigated the session model yet? It really should not be hard to figure out from there. See app/code/core/Mage/Core/Model/Session.php (from the top of my head). – Melvyn Nov 18 '14 at 8:11
2

The event in question is customer_session_init. That is the real session, triggered for every visitor to the site.
Should you actually only be looking to track customers logging in try the event customer_login instead.

| improve this answer | |
1

you might be under given code is may useful to you and you can get some batter idea to generate event from that.

/* Check if the customer is logged in or not */

if (Mage::getSingleton('customer/session')->isLoggedIn()) {

/* Get the customer data */
$customer = Mage::getSingleton('customer/session')->getCustomer();
/* Get the customer's full name */
$fullname = $customer->getName();
/* Get the customer's first name */
$firstname = $customer->getFirstname();
/* Get the customer's last name */
$lastname = $customer->getLastname();
/* Get the customer's email address */
$email = $customer->getEmail();
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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