2014-04-03 142 views
2

我正在研究一個magneto項目。我想在我的帳戶鏈接附近添加主頁鏈接,我嘗試更改customer.xml文件,但是我無法看到任何更改並恢復爲原始代碼,但現在我的「我的帳戶」鏈接缺失,可以通過某些內容告訴我發生了什麼錯誤。Magento標題鏈接丟失

這是我的page.xml文件

<?xml version="1.0"?> 
<!-- 
/** 
* Magento 
* 
* NOTICE OF LICENSE 
* 
* This source file is subject to the Academic Free License (AFL 3.0) 
* that is bundled with this package in the file LICENSE_AFL.txt. 
* It is also available through the world-wide-web at this URL: 
* http://opensource.org/licenses/afl-3.0.php 
* If you did not receive a copy of the license and are unable to 
* obtain it through the world-wide-web, please send an email 
* to [email protected] so we can send you a copy immediately. 
* 
* DISCLAIMER 
* 
* Do not edit or add to this file if you wish to upgrade Magento to newer 
* versions in the future. If you wish to customize Magento for your 
* needs please refer to http://www.magentocommerce.com for more information. 
* 
* @category design 
* @package  base_default 
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) 
* @license  http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 
*/ 
--> 
<layout version="0.1.0"> 
<!-- 
Default layout, loads most of the pages 
--> 

    <default translate="label" module="page"> 
     <label>All Pages</label> 
     <block type="page/html" name="root" output="toHtml" template="page/2columns-right.phtml"> 

      <block type="page/html_head" name="head" as="head"> 
       <action method="addJs"><script>prototype/prototype.js</script></action> 
       <action method="addJs"><script>lib/ccard.js</script></action> 
       <action method="addJs"><script>prototype/validation.js</script></action> 
       <action method="addJs"><script>scriptaculous/builder.js</script></action> 
       <action method="addJs"><script>scriptaculous/effects.js</script></action> 
       <action method="addJs"><script>scriptaculous/dragdrop.js</script></action> 
       <action method="addJs"><script>scriptaculous/controls.js</script></action> 
       <action method="addJs"><script>scriptaculous/slider.js</script></action> 
       <action method="addJs"><script>varien/js.js</script></action> 
       <action method="addJs"><script>varien/form.js</script></action> 
       <action method="addJs"><script>mage/translate.js</script></action> 
       <action method="addJs"><script>mage/cookies.js</script></action> 

       <action method="addItem"><type>skin_js</type><name>js/bootstrap.js</name><params/></action> 

       <block type="page/js_cookie" name="js_cookies" template="page/js/cookie.phtml"/> 

       <action method="addCss"><stylesheet>css/font-awesome.css</stylesheet></action> 
                   <action method="addCss"><stylesheet>css/styles.css</stylesheet></action> 
                   <action method="addCss"><stylesheet>css/extra_style.css</stylesheet></action> 
       <action method="addCss"><stylesheet>css/grid_1170.css</stylesheet></action>     
       <action method="addCss"><stylesheet>css/responsive.css</stylesheet></action> 
       <action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action> 
       <action method="addCss"><stylesheet>css/superfish.css</stylesheet></action> 
       <action method="addCss"><stylesheet>css/camera.css</stylesheet></action> 
       <action method="addCss"><stylesheet>css/widgets.css</stylesheet></action> 
       <action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action> 

       <action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action> 
       <action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action> 
      </block> 

      <block type="core/text_list" name="after_body_start" as="after_body_start" translate="label"> 
       <label>Page Top</label> 
      </block> 

      <block type="page/html_notices" name="global_notices" as="global_notices" template="page/html/notices.phtml" /> 

      <block type="page/html_header" name="header" as="header"> 
       <block type="checkout/cart_sidebar" name="cart_header" template="checkout/cart/sidebar_header.phtml"> 
        <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action> 
        <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action> 
        <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action> 
        <block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout"> 
         <label>Shopping Cart Sidebar Extra Actions</label> 
        </block> 
       </block> 

       <block type="page/template_links" name="top.links" as="topLinks"/> 
       <block type="page/template_links" name="top.links.left" as="topLinksLeft"/> 
       <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/> 
       <block type="directory/currency" name="currency" template="directory/currency.phtml"/> 
       <block type="core/text_list" name="top.menu" as="topMenu" translate="label"> 
        <label>Navigation Bar</label> 
        <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/> 
       </block> 
       <block type="page/html_wrapper" name="top.container" as="topContainer" translate="label"> 
        <label>Page Header</label> 
        <action method="setElementClass"><value>top-container</value></action> 
       </block> 
      </block> 

      <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/> 

      <block type="core/text_list" name="left" as="left" translate="label"> 
       <label>Left Column</label> 
      </block> 

      <block type="core/messages" name="global_messages" as="global_messages"/> 
      <block type="core/messages" name="messages" as="messages"/> 

      <block type="core/text_list" name="content" as="content" translate="label"> 
       <label>Main Content Area</label> 
      </block> 

      <block type="core/text_list" name="right" as="right" translate="label"> 
       <label>Right Column</label> 
      </block> 

      <block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml"> 
       <block type="cms/block" name="footer_list"> 
        <action method="setBlockId"><block_id>footer_list</block_id></action> 
       </block> 
       <block type="cms/block" name="footer_info"> 
        <action method="setBlockId"><block_id>footer_info</block_id></action> 
       </block> 
       <block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label"> 
        <label>Page Footer</label> 
        <action method="setElementClass"><value>bottom-container</value></action> 
       </block> 
       <block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/> 
       <block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/> 
      </block> 

      <block type="core/text_list" name="before_body_end" as="before_body_end" translate="label"> 
       <label>Page Bottom</label> 
      </block> 
     </block> 

     <block type="core/profiler" output="toHtml" name="core_profiler"/> 
    </default> 

    <print translate="label" module="page"> 
     <label>All Pages (Print Version)</label> 
     <!-- Mage_Page --> 
     <block type="page/html" name="root" output="toHtml" template="page/print.phtml"> 

      <block type="page/html_head" name="head" as="head"> 
       <action method="addJs"><script>prototype/prototype.js</script></action> 
       <action method="addJs"><script>mage/translate.js</script></action> 
       <action method="addJs"><script>lib/ccard.js</script></action> 
       <action method="addJs"><script>prototype/validation.js</script></action> 
       <action method="addJs"><script>varien/js.js</script></action> 

       <action method="addCss"><stylesheet>css/styles.css</stylesheet></action> 
       <action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action> 
       <action method="addCss"><stylesheet>css/widgets.css</stylesheet></action> 
       <action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action> 

       <action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action> 
       <action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action> 

      </block> 

      <block type="core/text_list" name="content" as="content" translate="label"> 
       <label>Main Content Area</label> 
      </block> 

     </block> 
    </print> 

    <!-- Custom page layout handles --> 
    <page_empty translate="label"> 
     <label>All Empty Layout Pages</label> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/empty.phtml</template></action> 
      <!-- Mark root page block that template is applied --> 
      <action method="setIsHandle"><applied>1</applied></action> 
     </reference> 
    </page_empty> 

    <page_one_column translate="label"> 
     <label>All One-Column Layout Pages</label> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
      <!-- Mark root page block that template is applied --> 
      <action method="setIsHandle"><applied>1</applied></action> 
     </reference> 
    </page_one_column> 

    <page_two_columns_left translate="label"> 
     <label>All Two-Column Layout Pages (Left Column)</label> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/2columns-left.phtml</template></action> 
      <!-- Mark root page block that template is applied --> 
      <action method="setIsHandle"><applied>1</applied></action> 
     </reference> 
    </page_two_columns_left> 

    <page_two_columns_right translate="label"> 
     <label>All Two-Column Layout Pages (Right Column)</label> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/2columns-right.phtml</template></action> 
      <!-- Mark root page block that template is applied --> 
      <action method="setIsHandle"><applied>1</applied></action> 
     </reference> 
    </page_two_columns_right> 

    <page_three_columns translate="label"> 
     <label>All Three-Column Layout Pages</label> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/3columns.phtml</template></action> 
      <!-- Mark root page block that template is applied --> 
      <action method="setIsHandle"><applied>1</applied></action> 
     </reference> 
    </page_three_columns> 
</layout> 

這是我customer.xml文件

<?xml version="1.0"?> 
<!-- 
/** 
* Magento 
* 
* NOTICE OF LICENSE 
* 
* This source file is subject to the Academic Free License (AFL 3.0) 
* that is bundled with this package in the file LICENSE_AFL.txt. 
* It is also available through the world-wide-web at this URL: 
* http://opensource.org/licenses/afl-3.0.php 
* If you did not receive a copy of the license and are unable to 
* obtain it through the world-wide-web, please send an email 
* to [email protected] so we can send you a copy immediately. 
* 
* DISCLAIMER 
* 
* Do not edit or add to this file if you wish to upgrade Magento to newer 
* versions in the future. If you wish to customize Magento for your 
* needs please refer to http://www.magentocommerce.com for more information. 
* 
* @category design 
* @package  base_default 
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) 
* @license  http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 
*/ 

Supported layout update handles (action): 
- customer_account_index 
- customer_address_index 
- customer_address_view 
- customer_account_login 
- customer_account_logoutsuccess 
- customer_account_create 
- customer_account_forgotpassword 
- customer_account_confirmation 
- customer_account_edit 

Supported layout update handles (special): 
- default 

--> 
<layout version="0.1.0"> 

<!-- 
Default layout, loads most of the pages 
--> 

    <default> 
     <!-- Mage_Customer --> 
     <reference name="top.links"> 
      <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> 
    </default> 

<!-- 
Load this update on every page when customer is logged in 
--> 

<customer_logged_in> 
    <reference name="top.links.left"> 
     <action method="addLink" translate="label title" module="customer"> 
      <label>Log Out</label> 
      <url>customer/account/logout</url> 
      <title>Log Out</title> 
      <prepare>true</prepare> 
      <urlParams helper="core/url/getHomeUrl"/> 
      <position>100</position> 
      <liParams/> 
      <aParams>class="Logout_link"</aParams> 
      <beforeText></beforeText> 
      <afterText></afterText> 
     </action> 
    </reference> 
</customer_logged_in> 

<!-- 
Load this update on every page when customer is logged out 
--> 

<customer_logged_out> 
    <reference name="top.links.left"> 
     <action method="addLink" translate="label title" module="customer"> 
      <label>Log In</label> 
      <url>customer/account/login</url> 
      <title>Log In</title> 
      <prepare>true</prepare> 
      <urlParams helper="core/url/getHomeUrl"/> 
      <position>100</position> 
      <liParams/> 
      <aParams>class="Login_link"</aParams> 
      <beforeText></beforeText> 
      <afterText></afterText> 
     </action> 
    </reference> 
</customer_logged_out> 

<!-- 
Layout for customer login page 
--> 

    <customer_account_login translate="label"> 
     <label>Customer Account Login Form</label> 
     <!-- Mage_Customer --> 
     <remove name="right"/> 
     <remove name="left"/> 

     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="content"> 
      <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml" /> 
     </reference> 
    </customer_account_login> 

<!-- 
Layout for customer log out page 
--> 

    <customer_account_logoutsuccess translate="label"> 
     <label>Customer Account Logout Success</label> 
     <!-- Mage_Customer --> 
     <remove name="right"/> 
     <remove name="left"/> 

     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="content"> 
      <block type="core/template" name="customer_logout" template="customer/logout.phtml"/> 
     </reference> 
    </customer_account_logoutsuccess> 

<!-- 
New customer registration 
--> 

    <customer_account_create translate="label"> 
     <label>Customer Account Registration Form</label> 
     <!-- Mage_Customer --> 
     <remove name="right"/> 
     <remove name="left"/> 

     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="content"> 
      <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"> 
       <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label"> 
        <label>Form Fields Before</label> 
       </block> 
      </block> 
     </reference> 
    </customer_account_create> 

    <customer_account_forgotpassword translate="label"> 
     <label>Customer Forgot Password Form</label> 
     <remove name="right"/> 
     <remove name="left"/> 

     <reference name="head"> 
      <action method="setTitle" translate="title" module="customer"><title>Forgot Your Password</title></action> 
     </reference> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
      <action method="setHeaderTitle" translate="title" module="customer"><title>Password forgotten</title></action> 
     </reference> 
     <reference name="content"> 
      <!--<block type="core/template" name="forgotPassword" template="customer/form/forgotpassword.phtml"/>--> 
      <block type="customer/account_forgotpassword" name="forgotPassword" template="customer/form/forgotpassword.phtml" /> 
     </reference> 
    </customer_account_forgotpassword> 

    <customer_account_resetpassword translate="label"> 
     <label>Reset a Password</label> 
     <remove name="right"/> 
     <remove name="left"/> 

     <reference name="head"> 
      <action method="setTitle" translate="title" module="customer"> 
       <title>Reset a Password</title> 
      </action> 
     </reference> 
     <reference name="root"> 
      <action method="setTemplate"> 
       <template>page/1column.phtml</template> 
      </action> 
      <action method="setHeaderTitle" translate="title" module="customer"> 
       <title>Reset a Password</title> 
      </action> 
     </reference> 
     <reference name="content"> 
      <block type="customer/account_resetpassword" name="resetPassword" template="customer/form/resetforgottenpassword.phtml"/> 
     </reference> 
    </customer_account_resetpassword> 

    <customer_account_confirmation> 
     <remove name="right"/> 
     <remove name="left"/> 

     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
      <action method="setHeaderTitle" translate="title" module="customer"><title>Send confirmation link</title></action> 
     </reference> 
     <reference name="content"> 
      <block type="core/template" name="accountConfirmation" template="customer/form/confirmation.phtml"/> 
     </reference> 
    </customer_account_confirmation> 

    <customer_account_edit translate="label"> 
     <label>Customer Account Edit Form</label> 
     <update handle="customer_account"/> 
     <reference name="root"> 
      <action method="setHeaderTitle" translate="title" module="customer"><title>Edit Account Info</title></action> 
     </reference> 
     <reference name="my.account.wrapper"> 
      <block type="customer/form_edit" name="customer_edit" template="customer/form/edit.phtml"/> 
     </reference> 

     <reference name="left"> 
      <action method="unsetChild"><name>left.permanent.callout</name></action> 
     </reference> 
    </customer_account_edit> 

<!-- 
Customer account pages, rendered for all tabs in dashboard 
--> 

    <customer_account translate="label"> 
     <label>Customer My Account (All Pages)</label> 
     <!--remove name="catalog.compare.sidebar"/> 
     <remove name="sale.reorder.sidebar"/--> 
     <!-- Mage_Customer --> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/2columns-right.phtml</template></action> 
     </reference> 

     <reference name="content"> 
      <block type="page/html_wrapper" name="my.account.wrapper" translate="label"> 
       <label>My Account Wrapper</label> 
       <action method="setElementClass"><value>my-account</value></action> 
      </block> 
      <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml"> 
       <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action> 
       <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action> 
       <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action> 
      </block> 
     </reference> 
     <reference name="left"> 
      <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml"> 
       <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action> 
       <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action> 
       <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action> 
      </block> 


     </reference> 
    </customer_account> 

<!-- 
Customer account home dashboard layout 
--> 

    <customer_account_index translate="label"> 
     <label>Customer My Account Dashboard</label> 
     <update handle="customer_account"/> 
     <!-- Mage_Customer --> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/2columns-right.phtml</template></action> 
     </reference> 
     <reference name="my.account.wrapper"> 
      <block type="customer/account_dashboard" name="customer_account_dashboard" template="customer/account/dashboard.phtml"> 
       <block type="customer/account_dashboard_hello" name="customer_account_dashboard_hello" as="hello" template="customer/account/dashboard/hello.phtml"/> 
       <block type="core/template" name="customer_account_dashboard_top" as="top" /> 
       <block type="customer/account_dashboard_info" name="customer_account_dashboard_info" as="info" template="customer/account/dashboard/info.phtml"/> 
       <block type="customer/account_dashboard_newsletter" name="customer_account_dashboard_newsletter" as="newsletter" template="customer/account/dashboard/newsletter.phtml"/> 
       <block type="customer/account_dashboard_address" name="customer_account_dashboard_address" as="address" template="customer/account/dashboard/address.phtml"/> 
      </block> 
     </reference> 

    </customer_account_index> 

<!-- 
Customer account address book 
--> 

    <customer_address_index translate="label"> 
     <label>Customer My Account Address Book</label> 
     <!-- Mage_Customer --> 
     <update handle="customer_account"/> 
     <reference name="my.account.wrapper"> 
      <block type="customer/address_book" name="address_book" template="customer/address/book.phtml"/> 
     </reference> 
    </customer_address_index> 

<!-- 
Customer account address edit page 
--> 

    <customer_address_form translate="label"> 
     <label>Customer My Account Address Edit Form</label> 
     <!-- Mage_Customer --> 
     <update handle="customer_account"/> 
     <reference name="my.account.wrapper"> 
      <block type="customer/address_edit" name="customer_address_edit" template="customer/address/edit.phtml"/> 
     </reference> 
    </customer_address_form> 

</layout> 
+0

我認爲引用是在customer.xml的缺省部分中的引用是'not'' – James

+0

有同樣的問題,甚至當恢復到基本/默認主題。頂部鏈接只說「我的購物車」和「結帳」。此外,/index.php/customer/account上的登錄頁面爲空,不會加載任何phtml文件。 – Anthony

回答

2

在Magento的標題鏈接沒有任何單獨的文件。
這是來自特定模塊調用頭部鏈接的顯示。
在Magento的標題鏈接如下

  • 我的帳戶
  • 我的收藏
  • 我的購物車
  • 結帳
  • 登錄

app\design\frontend\YOUR_THEME\default\layout\customer.xml聽到My Account顯示。


<reference name="top.links"> 
      <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> 

My Wishlistapp\design\frontend\YOUR_THEME\default\layout\wishlist.xml顯示。


<reference name="top.links"> 
      <block type="wishlist/links" name="wishlist_link" /> 
      <action method="addLinkBlock"><blockName>wishlist_link</blockName></action> 
</reference> 

My Cart和從app\design\frontend\YOUR_THEME\default\layout\checkout.xmlCheckout顯示。


<reference name="top.links"> 
      <block type="checkout/links" name="checkout_cart_link"> 
       <action method="addCartLink"></action> //For My Cart 
       <action method="addCheckoutLink"></action> //For Checkout 
      </block> 
</reference> 

Log Inapp\design\frontend\YOUR_THEME\default\layout\customer.xml顯示。


<reference name="top.links"> 
      <action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action> 
</reference> 

+0

是的,我可以看到xml文件有這些代碼,但鏈接仍然不可見我也給了我的page.xml代碼 –

1

Magento在更新期間做了一些更改。

你必須在複製下面你的主題:


複製:

design/frontend/base/default/template/page/template/links.phtml 

分爲:

design/frontend/default/YOUR_THEME/template/page/template/links.phtml 

複製:

design/frontend/base/default/template/page/template/linksblock.phtml 

分爲:

design/frontend/default/YOUR_THEME/template/page/template/linksblock.phtml 

複製:

design/frontend/base/default/template/wishlist 

分爲:

design/frontend/default/YOUR_THEME/template/wishlist 

複製:

design/frontend/base/default/layout/wishlist.xml 

分爲:

design/frontend/default/YOUR_THEME/layout/wishlist.xml 

清除您的緩存和所有應該不錯!

+0

謝謝。這不知何故似乎是問題:) – Milkmannetje