Magento将引荐参数添加到getLoginPostUrl() [英] Magento adding referer param to getLoginPostUrl()

查看:106
本文介绍了Magento将引荐参数添加到getLoginPostUrl()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一种将登录信息尽可能无缝地集成到流程中的表单.

I'm trying to create a form that integrates the login into the process as seamlessly as possible.

目前我正在使用Mage::helper('customer')->getLoginPostUrl()来登录表单,如果有更好的使用方法,我会全力以赴,并且可以使用,但最终会出现在用户仪表板上.

I'm using Mage::helper('customer')->getLoginPostUrl() at the moment for the login form, if there is something better to use I'm all ears, and it works, but it ends up at the user dashboard.

我查找了该功能及其所需的内容 if($this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME)){ 但是我不确定如何通过函数读取它的方式来赋予它参数.

I looked up the function and its looking for if($this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME)){ but I'm not sure how to give it the param in a way that the function will read it.

我注意到,如果我使用Mage::helper('customer')->getLoginUrl(),它会添加引荐来源本身,因此我对其进行了跟踪并发现了它是如何将编码的引荐来源添加到url的,并以此结束

I noticed if I use Mage::helper('customer')->getLoginUrl() it adds the referer itself, so I traced it and found how it adds the encoded referer to the url and ended up with this

<?php echo Mage::helper('customer')->getLoginPostUrl(); ?>referer/<?php echo Mage::helper('core')->urlEncode($this->getUrl("frontname/controller/function")); ?>

哪个给我一个看起来像这样的网址

Which gives me a url that looks like this

http://www.mysite.com/customer/account/loginPost/referer/aHR0cDovL3J5YW4uZGV2L3VzL2Zyb250bmFtZS9jb250cm9sbGVyL2Z1bmN0aW9uLw,,/

哪个有效,但我认为必须有更好的方法.有人有什么主意吗?

Which works, but I'm thinking there has to be a better way. Anyone have any idea?

如果...不适合我,以防万一其他人正在寻找相同的东西.

If not... that works for me, in case anyone else is looking for the same thing.

推荐答案

我已经这样做了,希望对大家也有帮助:

I've done it in this way, hope this helps for somebody as well:

Mage::getUrl('customer/account/login', array('referer' => Mage::helper('core')->urlEncode($this->getUrl("frontname/controller/function"))))

这篇关于Magento将引荐参数添加到getLoginPostUrl()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆