2013-09-21 57 views
1

我有那個local.xml設置如下:Magento的倍率嵌套塊

<cms_index_index translate="label"> 
    <reference name="content"> 
     <block name="promos" type="page/html" template="cms/promos/homepage.phtml" as="promos" /> 
     <block type="page/html_wrapper" name="home.footer"> 
     <action method="setElementClass"><value>l-two-col group</value></action> 
      <block type="page/html_wrapper" name="home.footer.main"> 
       <action method="setElementClass"><value>l-main</value></action> 
       <block type="page/html" name="featured_products" template="catalog/category/favourites.phtml" as="featured_products" /> 
      </block>   
      <block type="page/html_wrapper" name="home.footer.side"> 
      <action method="setElementClass"><value>l-sidebar</value></action> 
       <block type="vertnav/navigation" name="catalog.vertnav" as="vertnav" template="vertnav/left.phtml"> 
        <action method="setCategoryId"><category_id>3</category_id></action> 
       </block> 
      </block> 
     </block> 
    </reference> 
</cms_index_index> 

我有下面的代碼在其被正確地更換「節目預告」的塊的模塊佈局的xml文件,但我不能讓它爲名爲「featured_products」的塊執行相同的操作。

<cms_index_index translate="label"> 
    <remove name="promos"></remove> 
    <reference name="content"> 
     <block type="page/html" template="cms/promos/homepage-usa.phtml" as="promos" /> 
    </reference> 
</cms_index_index> 

有沒有人知道我可以如同我已經做的促銷塊一樣替換featured_products集團?

我曾嘗試:提前

<reference name="content"> 
    <block type="page/html" template="cms/promos/homepage-usa.phtml" as="promos" /> 
     <reference name="home.footer"> 
      <reference name="home.footer.main"> 
       <block type="page/html" name="featured_products1" template="catalog/category/favourites-usa.phtml" as="featured_products1" /> 
      </reference> 
     </reference> 
</reference> 

感謝,

戴夫

回答

1

而你是在local.xml,我不知道爲什麼你不只是去掉指令。在任何情況下:

  1. <remove name="featured_products"/>

    <action method="unsetChild" block="home.footer.main"><child>featured_products</child></action> 
    
  2. 你應該總是一個name屬性添加到您的塊。

+0

感謝benmarks,我應該說我可以刪除就OK了,只是沒有替換/它重新添加爲目錄/分類/收藏夾,usa.phtml – dhardy

+0

@benmarks,+1從我身邊正確的解決方案.. !很好... – liyakat

+0

第二塊代碼不在local.xml中 – dhardy