mefimess Posted October 31, 2014 Share Posted October 31, 2014 Hello Dear Friends ! I have got a big problem with customizing my prestashop 1.6 . I'd like to create login and registration in fancybox. I've created this, and now I've got small form in fancybox. I've read in API docs, that I have to call my login method in url by http://mydomain.com/....&ajax. I've tried to do like that, I copied link to auth module (by firebug) and it seems like that: <form id="login_form" method="post" action="index.php?controller=authentication&ajax"> when I click on submit button I try to show results by ajax: $('form#login_form').submit(function(e) { e.preventDefault(); var data = $(this).serialize(); $.ajax({ type: "POST", url: "index.php?controller=authentication&ajax", data: data, dataType: 'json', success: function(html){ console.log(html); }, error: function() { alert('error'); } }); }); but it seems, that I got results from controller Auth, method initContent, as I get in json answerd fields like : 'hasError', 'errors', 'page', 'token'; 'hasError' is set to false, 'errors' is empty. How can I call a method processSubmitLogin from AuthController (I think there is authentication mechanism) ? I would be very grateful if anyone could help me ... Greetings. Link to comment Share on other sites More sharing options...
Myst26 Posted March 30, 2015 Share Posted March 30, 2015 Hi, see : http://doc.prestashop.com/display/PS16/Using+jQuery+and+Ajax Link to comment Share on other sites More sharing options...
xiparos Posted April 24, 2015 Share Posted April 24, 2015 Hi, I am dealing with the same issue , ajax login with callback. I'd like to know how do you update user info block status when a customer successfully logged in ? I've put these as callback information in processSubmitLogin() method $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors, 'token' => Tools::getToken(false), 'lastname' => $customer->lastname, 'firstname' => $customer->firstname, 'isLogged' => true ); $this->ajaxDie(Tools::jsonEncode($return)); How could I inform nav.tpl that isLogged= true, so that it updates its content ? Thanks in advance for your reply. Best Regards Link to comment Share on other sites More sharing options...
xiparos Posted April 25, 2015 Share Posted April 25, 2015 I've found the answer, $this->context->smarty->assign(array( 'isLogged' => $this->context->cookie->logged )); That will assign isLogged value in nav.tpl so that it updates its content after ajax callback Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now