luismartin Posted March 6, 2013 Share Posted March 6, 2013 (edited) I need to allow a quick registration in a Prestashop web to our visitors in a trade fair, and I've made a registration form outside the Prestashop framework with just a few fields (1st name, surname, email, postal code/zip, newsletter checkbox and conditions/privacy agreement). It must be a clean screen with just the logo and the form. When the visitors send it, a process must store their data. What I'm not sure of is which table fields should the process fill in in order to have them enabled as new users when they sign in. I suppose it's necessary to fill in the "not null" fields without defaults in "ps_customer", and in "ps_address". Is any additional table necessary? How's the password generation algorithm? The process will create it and send it to the new user. Maybe someone of you needed to do this previously, or maybe you simply know the intrincacies of Prestashop's registration process. I haven't had enough time to delve into it yet. Edited March 6, 2013 by luismartin (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted March 7, 2013 Share Posted March 7, 2013 Hi, You'll need to use the web service to access the inner workings of prestashop from an external site, here is the reference in the docs: http://doc.prestashop.com/display/PS14/Using+the+REST+webservice Link to comment Share on other sites More sharing options...
luismartin Posted March 7, 2013 Author Share Posted March 7, 2013 (edited) Hi Nemo1, thanks for your tip. I didn't know that. However I've just implemented the whole form, its validation and DB insertion (using codeigniter). It's located in the same domain (in a subdirectory). Everything is working fine except that when I try to log in with a test customer I've made, there's a password error. As far as I know, passwords in Prestashop are generated this way: md5($user_password . $cookie_key). I copied the cookie key from settings.inc.php The other tricky thing was to generate the secure_key, which I made this way (I saw it in another forum): md5(uniqid(rand(), true)); The user is active by default. Is there anything else I should do to allow a new user (signed up from this form) to log in into Prestashop? Edited March 7, 2013 by luismartin (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted March 7, 2013 Share Posted March 7, 2013 Oh! Well, i you came this far...have you set the user as active? Link to comment Share on other sites More sharing options...
luismartin Posted March 7, 2013 Author Share Posted March 7, 2013 (edited) Yes, they're active from the start. I had to change from md5($user_password . $cookie_key) to md5( $cookie_key . $user_password). My mistake. Now I can log in with the newly created user. However there's a strange thing happening if I log in with these type of users: no module is being displayed, including the log in/out module. What could be happening? I suspect it might be because these users are assigned to a new group I created called "trade fair customers", even though it has no unauthorized module. I will reassign them to the regular "customer" group to see if I solve it. But if you know it must be something else I missed I would appreciate any suggestion. EDIT: No, it's not because of the group. There must be some other thing I must do. Any ideas? Edited March 7, 2013 by luismartin (see edit history) Link to comment Share on other sites More sharing options...
luismartin Posted March 7, 2013 Author Share Posted March 7, 2013 Solved! I forgot to populate ps_customer_group accordingly. Thanks again for your tip about the web service! I will consider it in the future. Link to comment Share on other sites More sharing options...
benjamin utterback Posted March 7, 2013 Share Posted March 7, 2013 Thank you luismartin, thank you for confirming the solution. I will go ahead and mark this thread as SOLVED. Thank you for choosing PrestaShop. Link to comment Share on other sites More sharing options...
kelvz Posted July 1, 2013 Share Posted July 1, 2013 have you tested your login in chrome browser... because i also create sign-up new customers from an outer form and do auto login there by submitting email and passwd $_POST in autentication.php file... but something went wrong when my login success, then i refresh the page, my user account automatically logout... sorry for my english.. Link to comment Share on other sites More sharing options...
Recommended Posts