hurquiza Posted December 6, 2013 Share Posted December 6, 2013 (edited) I'm trying to create a new customer and log him in at the same time via code, yet the cookie is setup it doesn't log in properly. Here's the code I'm using: require(dirname(__FILE__).'/config/config.inc.php'); $customer=new Customer(); $customer->email='[email protected]'; $customer->lastname='[edit me]'; $customer->firstname='[edit me]'; $customer->passwd='no password'; $customer->add(); $context=Context::getContext(); $context->customer = $customer; $context->smarty->assign('confirmation', 1); $context->cookie->id_customer = (int)$customer->id; $context->cookie->customer_lastname = $customer->lastname; $context->cookie->customer_firstname = $customer->firstname; $context->cookie->passwd = $customer->passwd; $context->cookie->logged = 1; if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) $context->cookie->account_created = 1; $customer->logged = 1; $context->cookie->email = $customer->email; $context->cookie->is_guest = !Tools::getValue('is_new_customer', 1); I would like to know what I'm missing Thanks! Edited December 9, 2013 by hurquiza (see edit history) Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now