2013-03-14 41 views
0

我創建了一個新的模塊,以取代客戶/帳戶菜單,並有一個鏈接www.mysite.com/accountMagento的自定義URL

我現在想更改登錄,註冊和其他頁面顯示爲www.mysite.com/account/login等

,而不是回覆到客戶/帳號/密碼等

請告訴我做到這一點的最好方法是什麼?

以下是config.xml的代碼伊夫迄今取得....

<?xml version="1.0"?> 
<config> 
    <modules> 
    <SquareNetMedia_MyAccount> 
     <version>0.1.0</version> 
    </SquareNetMedia_MyAccount> 
    </modules> 
    <frontend> 
    <routers> 
     <myaccount> 
     <use>standard</use> 
      <args> 
      <module>SquareNetMedia_MyAccount</module> 
      <frontName>account</frontName> 
      </args> 
     </myaccount> 
    </routers> 
     <layout> 
      <updates> 
      <myaccount> 
       <file>myaccount.xml</file> 
      </myaccount> 
      </updates> 
     </layout> 
    </frontend> 
    <global> 

    <helpers> 
     <myaccount> 
     <class>SquareNetMedia_MyAccount_Helper</class> 
     </myaccount> 
    </helpers> 
    <blocks> 
     <myaccount> 
     <class>SquareNetMedia_MyAccount_Block</class> 
     </myaccount> 
    </blocks> 
    </global> 
</config> 
+0

Magento使用以下標準URL格式:site.com/modulename/controller/action如果你想要一個不同的網址格式,然後嘗試與magento重寫或使用一些.htaccess規則 – oscprofessionals 2013-03-14 20:50:17

回答

0

更改您的文件,看起來像這樣:

<frontend> 
<routers> 
<myaccount> 
    <use>standard</use> 
     <args> 
     <module>SquareNetMedia_MyAccount</module> 
     <frontName>account</frontName> 
     </args> 
    </myaccount> 
    <customer> 
    <args> 
     <modules> 
     <SquareNetMedia_MyAccount before="Mage_Customer_AccountController">SquareNetMedia_MyAccountr</SquareNetMedia_MyAccount> 
     </modules> 
    </args> 
    </customer> 

然後讓所謂的AccountController一個新的控制器文件。 PHP在您的模塊的控制器文件夾中

<?php 
require_once Mage::getModuleDir('controllers','Mage_Customer').DS.'AccountController.php'; 
class SquareNetMedia_MyAccount_AccountController extends Mage_Customer_AccountController{ 
} 

現在您可以覆蓋功能

public function loginAction(){ 
#Here you can do what you need I think 
} 

我希望是的,讓我知道如果它不清楚。和平。

+0

謝謝 - 我已經改變了我的代碼,但現在我所有得到是一個404錯誤 而不是帳戶Controller.php我以前使用IndexController.php,它加載了新的佈局,但現在當你修改上面的代碼沒有什麼作品 – 2013-03-16 15:49:16