2010-04-14 21 views
7

Tôi phải thêm liên kết Đăng ký trong các liên kết trình đơn trên cùngLàm thế nào tôi có thể thêm liên kết đăng ký trong các liên kết hàng đầu trong Magento

Vì vậy, tôi đã làm điều này, nhưng tôi không biết whats helper để đăng ký. Vui lòng giúp tôi

<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

Không rõ bạn đang ở đâu sau đây. Bạn có thể giải thích thêm những gì bạn đang cố gắng làm và tại sao bạn muốn "helper cho đăng ký"? Giải thích rằng có thể làm cho nó rõ ràng hơn những gì bạn đang sau. –

+0

Tôi muốn thêm liên kết Đăng ký trang ở trên cùng như liên kết trang đăng nhập ở trên cùng, – Elamurugan

Trả lời

11

Sử dụng customer/getRegisterUrl làm người trợ giúp của bạn để nhận URL đăng ký. Điều này có nghĩa là Magento làm điều gì đó như sau:

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

Hy vọng điều đó sẽ hữu ích.

Cảm ơn, Joe

+0

vâng tôi đã làm, nhưng nó không hoạt động đối với tôi. – Elamurugan

14

gì bạn đã làm gần như là chính xác, nhưng thay vì customer/getAccountUrl bạn nên sử dụng customer/getRegisterUrl.

Vì vậy, về cơ bản bạn nên thêm dòng xml sau trong 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> 

Vì vậy, mã của bạn sẽ trông như thế này:

<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> 

Hope this helps bất cứ ai.

+0

THANK YOUUUUUU !!! –

-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

Hãy thử và đặt một mô tả nhỏ trong câu trả lời của bạn và định dạng đoạn mã của bạn một cách chính xác. – simonmorley

+0

Tôi xin lỗi, nhưng tôi đang bỏ phiếu này. Tôi không thể tìm thấy hàm 'customer/getCreateUrl'. Nếu nó hoạt động cho bạn, điều này có thể là do bạn đã cài đặt một số tiện ích mở rộng. – Dan

Các vấn đề liên quan