2010-04-14 39 views
7

我要補充的頂部菜單註冊鏈接添加在上面的鏈接註冊鏈接鏈接我怎樣才能在Magento

所以我這樣做,但我不知道什麼是輔助的寄存器。請幫助我

<customer_logged_in> 
     <reference name="top.links"> 
      <action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action> 
      <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action> 
     </reference> 
    </customer_logged_in> 


    <customer_logged_out> 
     <reference name="top.links"> 
      <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getLoginUrl"/><title>My Account</title><prepare/><urlParams/><position>100</position></action> 
      <action method="addLink" translate="label title" module="customer"><label>Register</label><url helper="customer/getAccountUrl"/><title>Register</title><prepare/><urlParams/><position>10</position></action> 
     </reference> 
     <remove name="wishlist_sidebar"></remove> 
     <remove name="reorder"></remove> 
    </customer_logged_out> 
+0

這是不是很清楚你在這裏後。你能否更詳細地解釋你想要做什麼以及爲什麼要「幫助註冊」?解釋這可能會讓你更清楚自己以後的事情。 – 2010-04-14 16:50:39

+0

我想添加頂部的註冊頁面鏈接,如頂部的登錄頁面鏈接, – Elamurugan 2010-04-15 04:20:53

回答

11

使用customer/getRegisterUrl作爲您的幫手來獲取註冊URL。這意味着,Magento做這樣的事情:

$helper = Mage::helper("customer"); // gets Mage_Customer_Helper_Data 
$url = $helper->getRegisterUrl(); 

希望有所幫助。

謝謝, 喬

+0

是的,我做到了,但它不適合我。 – Elamurugan 2010-04-15 04:47:05

14

你在做什麼是正確的差不多,但不是customer/getAccountUrl你應該使用customer/getRegisterUrl

所以基本上你應該添加下面的XML行customer_logged_out\reference

<action method="addLink" translate="label title" module="customer"><label>Register</label><url helper="customer/getRegisterUrl"/><title>Register</title><prepare/><urlParams/><position>10</position></action> 

所以,你的代碼看起來就像這樣:

<customer_logged_in> 
    <reference name="top.links"> 
     <action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action> 
     <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action> 
    </reference> 
</customer_logged_in> 


<customer_logged_out> 
    <reference name="top.links"> 
     <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getLoginUrl"/><title>My Account</title><prepare/><urlParams/><position>100</position></action> 
     <action method="addLink" translate="label title" module="customer"><label>Register</label><url helper="customer/getRegisterUrl"/><title>Register</title><prepare/><urlParams/><position>10</position></action> 
    </reference> 
    <remove name="wishlist_sidebar"></remove> 
    <remove name="reorder"></remove> 
</customer_logged_out> 

希望這有助於任何人。

+0

THANK YOUUUUUU !!! – 2014-07-07 08:13:38

-2
<action method="addLink" 
    translate="label title" 
    module="customer"> 
    <label> 
     Register 
    </label> 
    <url helper="customer/getCreateUrl"/> 
    <title>Register</title> 
    <prepare/> 
    <urlParams/> 
    <position>100</position> 
</action> 
+0

嘗試並在您的答案中加入一些說明,並正確設置代碼片段的格式。 – simonmorley 2013-01-16 09:13:22

+0

我很抱歉,但我對此投了反對票。我找不到'customer/getCreateUrl'函數。如果它適合你,這可能是因爲你安裝了一些擴展。 – Dan 2013-03-15 09:29:31