2014-02-14 44 views
0

我一直在研究客户在注册时选择需要注册哪个网站的模块。到目前为止,我已经做到了。 A quick reference。在成功注册时,客户将被重定向到当前网站的customer/account/,而不管他选择哪个网站。但我需要将他重定向到他已注册的特定网站。成功注册后将客户重定向到关联网站

到目前为止,我已经试过重写Customer/AccountController_welcomeCustomer()

protected function _welcomeCustomer($customer, $isJustConformed = false) { 
    $webid = $customer->getWebsiteId(); 
    $successurl = parent::_welcomeCustomer($customer, $isJustConfirmed); 
    if (Mage::app()->getStore()->getWebsiteId() == $webid) { 
     return $successurl; 
    } else { 
     return Mage::app()->getWebsite($webid)->getDefaultStore()->getBaseUrl() . 'customer/account/index'; 
    } 
} 

但不是客户重定向到相关的网站也被重定向到当前网站的主页。任何帮助?它怎么能做到?或者这是怎么发生的?

+0

我建议你[Magento](http://magento.stackexchange.com/questions/ask)StackExchange是这个更好的地方。 – Rikesh

+0

我不行。我想一个国防部可以。否则只要删除这一个,并在那边问一个新的。 – Rikesh

+0

@Rikesh:如果你能回答。我发布了它[有](http://magento.stackexchange.com/q/15045/4426) –

回答

0

这个auto-login module帮助我实现了我在找的东西。的事情
其余的我已经做了,使其正确就是工作:

覆盖了Customer/AccountController_welcomeCustomer()

protected function _welcomeCustomer($customer, $isJustConformed = false) { 
    $webid = $customer->getWebsiteId(); 
    $encpw = ;//get customer password and encrypt it; 
    if (Mage::app()->getStore()->getWebsiteId() == $webid) { 
     return parent::_welcomeCustomer($customer, $isJustConfirmed); 
    } else { 
     $redr = Mage::app()->getWebsite($webid)->getDefaultStore() 
         ->getBaseUrl() . 'customer/account/autoLogin/' 
       . 'user/' . $customer->getEmail() . '/pwd/' . $encpw . 
       '/'; 
     return $redr; 
    } 
} 

一件事可能需要_successProcessRegistration()改变与$this->_redirectUrl($url);更换$this->_redirectSuccess($url);

0

尝试将商店代码作为GET参数添加到URL(___ store = xyz)。 可能您还需要将会话ID添加到URL(参数名称:SID)。

+0

该网址应该如何看起来像?我是否添加加密的会话ID? –

+0

我试过它像'http://mymagento.com/store/index.php/customer/account/index/?SID= &___ store = '但仍然被重定向到登录页面 –