0

好的,所以我试图覆盖另一个扩展的布局文件。我正在使用 Magento Enterprise 1.13

这是我的 config.xml:

<config>
    <frontend>
        <layout>
            <updates>
                <mymodule>
                    <file>mymodule.xml</file>
                </mymodule>
            </updates>
        </layout>
    </frontend>
</config>

然后在设计/前端/企业/mytheme/layout/mymodule.xml:

<?xml version="1.0"?>
<layout version="0.1.0">       
    <affiliateplus_default>
        <update handle="page_two_columns_left" />
        <reference name="left">
            <block type="affiliateplus/account_navigation" before="-" name="account_navigator" template="affiliateplus/navigation.phtml">
                <action method="setNavigationTitle">
                    <title helper="affiliateplus/account/getNavigationLabel" />
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>balance</name>
                    <path>affiliateplus/inddsafdsex/paymentForm</path>
                    <label helper="affiliateplus/account/getBalanceLabel" />
                    <disabled helper="affiliateplus/account/accountNotLogin" />
                    <order>6</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>home</name>
                    <path>affiliateplus</path>
                    <label>Affiliate Home</label>
                    <disabled>0</disabled>
                    <order>10</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>login</name>
                    <path>affiliateplus/account/login</path>
                    <label>Login</label>
                    <disabled helper="affiliateplus/account/customerLoggedIn" />
                    <order>20</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>register</name>
                    <path>affiliateplus/account/register</path>
                    <label>Signup</label>
                    <disabled helper="affiliateplus/account/isRegistered" />
                    <order>30</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>banners</name>
                    <path>affiliateplus/banner/list</path>
                    <label><![CDATA[Banners & Links]]>
                    </label>
                    <disabled helper="affiliateplus/account/accountNotLogin" />
                    <order>40</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>refers</name>
                    <path>affiliateplus/refer/index</path>
                    <label><![CDATA[Refer Friends]]>
                    </label>
                    <disabled helper="affiliateplus/account/accountNotLogin" />
                    <order>43</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>materials</name>
                    <path>affiliateplus/index/materials</path>
                    <label>Materials</label>
                    <disabled helper="affiliateplus/config/disableMaterials" />
                    <order>100</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>sales</name>
                    <path>affiliateplus/index/listTransaction</path>
                    <label>Commissions</label>
                    <disabled helper="affiliateplus/account/accountNotLogin" />
                    <order>110</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>payments</name>
                    <path>affiliateplus/index/payments</path>
                    <label>Withdrawals</label>
                    <disabled helper="affiliateplus/account/accountNotLogin" />
                    <order>120</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>referrers</name>
                    <path>affiliateplus/index/referrers</path>
                    <label>Traffics</label>
                    <disabled helper="affiliateplus/account/accountNotLogin" />
                    <order>180</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>edit</name>
                    <path>affiliateplus/account/edit</path>
                    <label>Settings</label>
                    <disabled helper="affiliateplus/account/accountNotLogin" />
                    <order>190</order>
                </action>
                <action method="addLink" translate="label" module="affiliateplus">
                    <name>logout</name>
                    <path>affiliateplus/account/logout</path>
                    <label>Logout</label>
                    <disabled helper="affiliateplus/account/accountNotLogin" />
                    <order>200</order>
                </action>
            </block>
        </reference>
    </affiliateplus_default>    
</layout>

但是,当我刷新页面时,我得到两个导航窗格。起初我以为我只是附加到已经存在的那个上。但是,当我对我的进行更改时,它们都会出现。我能想到的只是它正在拉入我的布局......然后拉入他们的布局并看到我的覆盖并再次拉入我的布局。就个人而言,这是我第一次尝试这样做,所以我很可能做错了,但我找不到任何帮助。感谢您的任何帮助/评论。

4

1 回答 1

0

好吧,我找到了答案:

我真正的问题是我对引用和块的了解不够。

我的技术问题是我引用了一个块,然后创建了一个具有不同名称的新块。“左”块还包含一个版本的导航栏。这导致了重复的菜单。

我的最终代码如下所示:

    <affiliateplus_default>

        <block type="affiliateplus/account_navigation" before="-" name="account_navigator" template="affiliateplus/navigation.phtml">
            <action method="setNavigationTitle">
                <title helper="affiliateplus/account/getNavigationLabel" />
            </action>
            <action method="addLink" translate="label" module="affiliateplus">
                <name>balance</name>
                <path>affiliateplus/inddsafdsex/paymentForm</path>
                <label helper="affiliateplus/account/getBalanceLabel" />
                <disabled helper="affiliateplus/account/accountNotLogin" />
                <order>6</order>
            </action>

            ......

    </affiliateplus_default>

如果我只想添加一个链接而不是完全覆盖整个块,我可以执行以下操作:

    <affiliateplus_default>
      <reference="account_navigator">
        <action method="addLink" translate="label" module="affiliateplusext">
            [Link attributes]
        </action>
      </reference>
    </affiliateplus_default>

我希望这可以帮助刚开始的其他人。谢谢!

于 2013-06-06T19:32:15.593 回答