我正在嘗試使用我的local.xml文件(其中我執行了所有對佈局)的更新以刪除嵌套在另一個塊中的塊。可以通過<刪除>標籤或使用unsetChild方法輕鬆刪除塊,但我似乎無法刪除嵌套在另一個塊中的塊通過local.xml文件刪除嵌套在塊中的塊
以下是我嘗試刪除的代碼行(位於customer.xml文件)中,特別是名爲「customer_account_dashboard_newsletter」的區塊
<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 type="core/template" name="customer_account_dashboard_info1" as="info1" />
<block type="core/template" name="customer_account_dashboard_info2" as="info2" />
</block>
</reference>
</customer_account_index>
我知道這不,現在的工作,但這裏是我的出發點(位於我local.xml文件,):
<customer_account_index>
<reference name="my.account.wrapper">
<action method="unsetChild"><name>customer_account_dashboard_newsletter</name></action>
</reference>
</customer_account_index>
有什麼想法?謝謝。
此該塊不工作。有沒有其他方法可以做到這一點? – jdhaar 2013-07-17 11:21:27
也不適合我在Magento 1.8中工作。 – KoviNET 2014-03-01 11:13:52