Jump to content

[SOLVED] Sign Up New Customers From An Outer Form In Prestashop


Recommended Posts

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 by luismartin (see edit history)
Link to comment
Share on other sites

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 by luismartin (see edit history)
Link to comment
Share on other sites

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? :o

 

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 by luismartin (see edit history)
Link to comment
Share on other sites

  • 3 months later...

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

×
×
  • Create New...