I have a client login popup on my page with the form
action="<?= $block->escapeUrl($block->getPostActionUrl()) ?>"
How can I change this so the form will not redirect to the account dashboard?
I have set to redirect "no" in the backend. Does not help.
Thank you.
Edit after Prince answer:
My problem is that I do not know where to start. I have found something in
/home/admin/domains/qvicktime.eu/public_html/vendor/magento/module-customer/Controller/Ajax/Login.php
It might control the login?
And this code?
if (!$this->getScopeConfig()->getValue('customer/startup/redirect_dashboard') && $redirectRoute) {
$response['redirectUrl'] = $this->_redirect->success($redirectRoute);
$this->getAccountRedirect()->clearRedirectCookie();
}
But if I want to stay on the same page after login (the user should have logged in status after ajax/reload)
And there are many other files that might be the right one? How can I locate the right one? (same problem all the time 🙁 )
Best Answer
You do it in you
controller
,action="<?= $block->escapeUrl($block->getPostActionUrl()) ?>"
is a controller post url, this url is set in your that module block.When you post your form, the controller get that form params then it do some stuff and it redirect at the end, So you go to that controller then you change the url where you want to redirect after
fail
orsuccess
.To get the controller url, you have to go the
block module
then you checkgetPostActionUrl()
, or in console browser network (appear when submit a form).Update :
1) The code :
mean :
If you haven't set a value in admin config :
customer/startup/redirect_dashboard
, it will redirect to the$redirectRoute
Url.2) Don't update
vendor/magento/module-customer/...
, you have to rewrite this controller or do an observer for that.