2011-09-06 97 views
0

我看過以前的所有問題,並且我知道我的問題沒有重複。在Magento中擴展布局

請考慮以下方面:

我有一個佈局:

frontend\[base]\default\layout\customer.xml 

這支持手柄(動作):

  • 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

如果我想補充一個手柄:

frontend\[default]\default\layout\customer.xml 
  • customer_account_active

如何我只需添加更多的手柄象下面這樣:

<layout version="0.1.0"> 
    <customer_account_active> 
    ... 
    </customer_account_active> 
</layout> 

我的問題是,當我在[default]佈局添加customer.xml文件。它會增加錯誤。我想這是因爲擴展的文件不正確。

對我而言有什麼想法?

更新:

frontend\[base]\default\layout\customer.xml是:

<layout version="0.1.0"> 
    <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> 

    <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> 
     </reference> 
    </customer_logged_in> 
    <customer_logged_out> 
     <!---<reference name="right"> 
      <block type="customer/form_login" name="customer_form_mini_login" before="-" template="customer/form/mini.login.phtml"/> 
     </reference>--> 
     <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> 
     <remove name="wishlist_sidebar"></remove> 
     <remove name="reorder"></remove> 
    </customer_logged_out> 
    <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> 
    <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><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="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_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 translate="label"> 
     <label>Customer My Account (All Pages)</label> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/2columns-left.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> 
     </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> 
      <block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.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> 
      <block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/> 
      <block type="sales/reorder_sidebar" name="sale.reorder.sidebar" as="reorder" template="sales/reorder/sidebar.phtml"/> 
      <remove name="tags_popular"/> 
     </reference> 
    </customer_account> 
    <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-left.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_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_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> 

而且frontend\[default]\default\layout\customer.xml

<layout version="0.1.0">  
    <customer_account_active> 
     <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="customer/form_active" name="accountActive" as="accountActive" template="customer/account/active.phtml"/> 
     </reference> 
    </customer_account_active> 
</layout> 
+1

發佈您收到的錯誤,以及內容的customer.xml將幫助人們回答你的問題。 –

+0

@Alan:問題是我想擴展布局。我只是用很少的內容創建customer.xml文件。不要複製此文件並追加更多內容。好。我會更新你可以看到的錯誤。謝謝。 – vietean

回答

4

你的問題是,你正在爲你的customer.xml除去其他處理,而覆蓋在文件[默認] \默認上下文。如果您覆蓋不同主題文件夾中的文件,則必須記住將使用此文件而不是其他文件夾。

如果你想只此處理程序的文件,然後添加這local.xml中佈局文件,而不是(創建它,如果它不存在)