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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?