Magento2-登录重定向到上一页而不是我的帐户页面后
-
22-10-2019 - |
题
是否有一种简单的方法可以在Magento中自定义重定向URL?
我搜索了一些文章提到“控制器”。
但是我不知道自定义扩展。
如何用扩展名覆盖基本控制器动作?
解决方案
只需更改选项:
System > Config > Customer
> Costumer Redirect Customer to Account Dashboard after Logging in > NO
其他提示
不要更改核心/代码。使用以下免费扩展名:http://www.magentocommerce.com/magento-connect/customer-redirect-after-login-1.html
查看此答案以获取有关如何自己做的更多详细信息: https://stackoverflow.com/a/16099279/3403171
您也可以使用
对于Magento1.9。*作为一个 $this->_redirectReferer();
.
为此,配置设置应为 - >系统 - >配置 - >客户 - >客户配置 - >登录选项集:重定向客户登录后,将仪表板帐户帐户帐户=编号。
但是还有更多工作要做。为此,您无需更改任何课程。
只需在您中添加以下代码登录表单phtml <form>
标签。
<?php if (!Mage::getStoreConfigFlag(
Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD
)) { ?>
<input name="referer" type="hidden" value="<?php echo Mage::helper('core')->urlEncode(Mage::getBaseUrl()); ?>" />
<?php } ?>
登录表格的示例,
<form action="<?php echo $this->getPostActionUrl() ?>" method="post">
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
<?php if (!Mage::getStoreConfigFlag(
Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD
)) { ?>
<input name="referer" type="hidden" value="<?php echo Mage::helper('core')->urlEncode(Mage::getBaseUrl()); ?>" />
<?php } ?>
<div class="block-content">
<label for="mini-login"><?php echo $this->__('Email address:') ?></label><input type="text" name="login[username]" id="mini-login" class="input-text" />
<label for="mini-password"><?php echo $this->__('Password:') ?></label><input type="password" name="login[password]" id="mini-password" class="input-text" />
<div class="mini-actions">
<a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
<button type="submit" class="button"><span><span><?php echo $this->__('Log in') ?></span></span></button>
</div>
</div>
希望能帮助到你!!如果有帮助,请投票并接受它。