Configuration Settings
– Login to admin panel
– Go to System -> Configuration -> CUSTOMERS -> Customer Configuration -> Login Options
– Set: Redirect Customers to Account Dashboard after Loggin in = No
– You can see in comments for this field: Customer will stay on the current page if “No” is selected.
This setting will redirect customers to the page from where they have come to login page. This setting is applicable for all pages of your Magento website.
You might have another condition of having this feature only on some specific pages. For example, you might want this feature only on product view page. Or, you might have a category that is visible to logged in customers only. In this case, you can simply use the following code:
Redirect to customer login page
if(!Mage::helper('customer')->isLoggedIn()) { Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::helper('core/url')->getCurrentUrl()); //$this->_redirect('customer/account/login'); exit('<h2>Redirect to login page ... </h2><script>location="/customer/account/login/"</script>'); }
Show a login link for non-logged in customers
if(!Mage::helper('customer')->isLoggedIn()) { Mage::getSingleton('customer/session') ->setBeforeAuthUrl(Mage::helper('core/url')->getCurrentUrl()); echo '<p>Please <a href="'.Mage::getUrl('customer/account/login').'">Login</a> to view the page.</p>'; }
Customers will be redirected to previous page after successful login.
Hope it helps. Thanks.
原文:http://blog.chapagain.com.np/magento-redirect-customer-to-previous-page-after-login/
根据此原理,我们也可以修改成为url参数的形式。
// http://yourdomain.com/customer/account/login/?redirect=http://redirecturi.com if(!Mage::helper('customer')->isLoggedIn()) { Mage::getSingleton('customer/session')->setBeforeAuthUrl(isset($_GET['redirect']) ? $_GET['redirect'] : ''); //$this->_redirect('customer/account/login'); exit('<h2>Redirect to login page ... </h2><script>location="/customer/account/login/"</script>'); }
原文/转自: Magento: 自定义用户登录导向页面 Redirect Customer to Previous Page After Login
相关推荐
magento 自定义菜单插件,自定义菜单显示行和列,显示层级。
NULL 博文链接:https://justcoding.iteye.com/blog/1711166
允许您在客户登录,注销并创建新帐户后重定向到自定义页面。(禁止用作商业用途)
Magento:registered:2的“强制登录”模块允许您限制访问者可以看到哪些页面。 如果访问者页面未标记为可访问,则将其重定向到登录页面。 Magento:registered:2的强制登录模块对于仅服务于特定用户组的商家(例如与...
NULL 博文链接:https://justcoding.iteye.com/blog/2100394
magento2-force-login, Magento 2强制登录模块 如果页面没有标记为 visitable,访问者会被重定向到登录页面。 插件功能:在允许访客访问你的网页和目录之前,强制你的访客先登录( 或者 register )管理:管理区域中的...
Apress.The.Definitive.Guide.to.Magento.Dec.2009.pdf Apress于2009重磅推出的Magento上手书籍,原书地址:http://www.apress.com/book/view/9781430272298
MagentoBeginner's Guide.pdf [Packt]出品,最早的Magento精品书之一,原书地址:http://www.amazon.com/Magento-Beginners-Guide-William-Rice/dp/1847195946
magento的关于自定义后台配置的简单示例 把Exercise_Avatar.xml放到magento/app/etc/modules/下面 文件夹Avatar放到magento/app/code/local/Exercise/下面就可以到后台看到相应配置信息
magento判断用户是否登录和怎么获取登录者名称:
magento:magento-ce 2.4.0
magento通过mysql语句批量导出产品及其自定义属性
Magento:registered:2数据集成借助Datatric Connect扩展程序,可以轻松地将Magento:registered:2商店与Datatrics平台连接起来。安装在开始安装过程之前,我们建议您对webshop文件以及数据库进行备份。 有两种安装...
通过SFTP或SSH导航到Magento [Magento]/app/code/ 。 上载带有扩展名的Dropday/OrderAutomation目录。 打开终端并导航到Magento根目录。 运行以下命令以启用Dropday扩展: php bin/magento module:enable Dropday_...
描述:Magento 2.x产品的自定义折扣页面。 如果用户选择一种产品,则折扣0;如果客户选择2,则折扣3;如果折扣为3,则折扣为5%;如果折扣为4,则折扣为15%;如果折扣为5,则折扣为20%。 单项数量应为1,并且只能...
magento2在产品详情添加自定义tab,1. Enable module with php bin/magento module:enable BelVG_ProductTabs 2. Run php bin/magento setup:upgrade 3. Recompile DI php bin/magento setup:di:compile 4. Recompile...
自定义样板模块以扩展Algolia Magento 2模块模块,用于轻松扩展。导游安装可以通过安装模板模块: $ cd /path/to/your/magento2/directory$ composer require algolia/algoliasearch-custom-algolia-magento-2$ ...
Magento2-SmartSearch, Magento2 SmartSearch扩展 2.0 SmartSearch Magento 2型搜索实现。 在不重新加载页面的情况下显示栏下找到的产品列表。 这是一个基本的扩展,没有任何配置选项,它将默认的Magento自动完成...
Turiknox URL重写导入器概述一个简单的Magento模块,将允许您使用CSV文件将自定义URL重写导入管理员。要求Magento 2.1.x安装n 将模块的内容复制到您的Magento根目录中。 通过命令行启用模块: / path / to / ...
magento:Magento CE 1.x源代码