2014-02-14 43 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 = '但仍然被重定向到登錄頁面 –