如何在magento注册后重定向到上一页?

时间:2013-06-10 19:51:18

标签: magento redirect

我试图将客户重定向到审核页面,客户必须登录或注册才能对产品进行评分,并且我能够在登录后将客户重定向到评论页面,但我无法重定向客户在他们注册到网站后的评论页面,我找到了将客户重定向到仪表板的代码,但我不知道如何重定向到上一页。

  protected function _welcomeCustomer(Mage_Customer_Model_Customer $customer, $isJustConfirmed = false)
{
    $this->_getSession()->addSuccess(
        $this->__('Thank you for registering with %s.', Mage::app()->getStore()->getFrontendName())
    );

    $customer->sendNewAccountEmail(
        $isJustConfirmed ? 'confirmed' : 'registered',
        '',
        Mage::app()->getStore()->getId()
    );

    $successUrl = Mage::getUrl('*/*/index', array('_secure'=>true));


    if ($this->_getSession()->getBeforeAuthUrl()) {
        $successUrl = $this->_getSession()->getBeforeAuthUrl(true);
    }
    return $successUrl;
}

1 个答案:

答案 0 :(得分:1)

自己想出来,        必须在页面上添加一个会话变量,该变量具有到注册页面的链接

         $session = Mage::getSingleton('customer/session');
     $session->setBeforeAuthUrl( Mage::helper('core/url')->getCurrentUrl() );

我没有必要改变“_welcomeCustomer”功能。   这应该让客户回到他们点击注册链接的页面。

相关问题