So I've installed a new chat for my website but need to do one last thing, and that is to set a cookie on login, and delete it on log out.
Code I'll be using for login:
setcookie('cc_data',$userid, time() + (86400 * 30), "/");
Code I'll use to unset the cookie:
setcookie('cc_data', '', -time() + (86400 * 30), "/");
The part I need help with is where exactly to place this. Obviously I need the customer ID for $userid
so it needs to be after the login.
Disregarding all the "should not edit core files", is AccountController the correct file for this? I can add it in a more correct way in the future, but currently I'm just looking for my target file/function.
customer_login
andcustomer_logout
events? Also you can useMage::getModel('core/cookie')
to set cookies in Magento way. – Pedram Behroozi Feb 24 '18 at 8:39