dongpa2000 2013-09-02 08:56
浏览 24
已采纳

Magento覆盖其他模块中模块的块

Hi I have AffiliantePlus Module in Magento 1.7. I want overwrite register.phtml block.

In affiliate plus /app/design/frontend/mytheme/default/layout/affiliateplus.xml about register

<affiliateplus_account_register>
    <update handle="affiliateplus_default" />
    <reference name="content">
        <block type="affiliateplus/account_edit" name="affiliateplus_register" template="affiliateplus/account/register.phtml" />
    </reference>
</affiliateplus_account_register>

<affiliateplus_account_edit>
    <update handle="affiliateplus_default" />
    <reference name="content">
        <block type="affiliateplus/account_edit" name="affiliateplus_register" template="affiliateplus/account/edit.phtml" />
    </reference>
</affiliateplus_account_edit>

In /app/design/frontend/mytheme/defaule/layout/mymodule.xml

<layout varsion="0.1.0">
<affiliateplus_account_register>
    <update handle="affiliateplus_default" />
    <reference name="content">
        <block type="affiliateplus/account_edit" name="affiliateplus_register" template="partner/account/register.phtml"/>
    </reference>
</affiliateplus_account_register>

I tryed with mymodule/account_edit, mymodule_register

Block is overwrited but my block is show twice. It's problem because I can't change oryginal block.

  • 写回答

1条回答 默认 最新

  • du3669 2013-09-02 09:10
    关注

    You could do something like this...to get rid of the original block and add the new one with another name, since its obviously a self rendering content block.

    <affiliateplus_account_register>
     <reference name="content">
        <action method="unsetChild"><name>affiliateplus_register</name></action>
     </reference>
    </affiliateplus_account_register>
    

    But as you are just using another template i would advise you instead of your xml to simply change the template and keep everything else like it was

     <affiliateplus_account_register>   
       <reference name="affiliateplus_register">
         <action method="setTemplate">
           <template>partner/account/register.phtml</template>
         </action>   
      </reference> 
     </affiliateplus_account_register>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度